diff options
author | Bruce Momjian <bruce@momjian.us> | 2000-03-07 23:49:31 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2000-03-07 23:49:31 +0000 |
commit | 8fa8f80c1a5db7f21730c3f4bf336de2cd894d22 (patch) | |
tree | 74a977ea3f061ea0b70399f8e1bcaeb2579ed778 /src/backend/access/transam/xlog.c | |
parent | 9606f36210542ebc2dd6b040830f3c6c5859a4a6 (diff) |
I've recently written to pgsql-ports about a problem with PG7.0 on NT
(Subj: [PORTS] initdb problem on NT with 7.0). Since nobody helped me,
I had to find out the reson. The difference between NT and Linux (for
instance) is that "open( path, O_RDWR );" opens a file in text mode. So
sometime less block can be read than required.
I suggest a following patch. BTW the situation appeared before, see
hba.c, pqcomm.c and others.
Alexei Zakharov
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 3bf62d7e50a..e8d909f71ef 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.10 2000/02/15 03:00:37 thomas Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.11 2000/03/07 23:49:31 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -726,7 +726,11 @@ XLogFileInit(uint32 log, uint32 seg) unlink(path); tryAgain: +#ifndef __CYGWIN__ fd = open(path, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); +#else + fd = open(path, O_RDWR|O_CREAT|O_EXCL|O_BINARY, S_IRUSR|S_IWUSR); +#endif if (fd < 0 && (errno == EMFILE || errno == ENFILE)) { fd = errno; @@ -767,7 +771,11 @@ XLogFileOpen(uint32 log, uint32 seg, bool econt) XLogFileName(path, log, seg); tryAgain: +#ifndef __CYGWIN__ fd = open(path, O_RDWR); +#else + fd = open(path, O_RDWR | O_BINARY); +#endif if (fd < 0 && (errno == EMFILE || errno == ENFILE)) { fd = errno; @@ -1083,7 +1091,11 @@ UpdateControlFile() int fd; tryAgain: +#ifndef __CYGWIN__ fd = open(ControlFilePath, O_RDWR); +#else + fd = open(ControlFilePath, O_RDWR | O_BINARY); +#endif if (fd < 0 && (errno == EMFILE || errno == ENFILE)) { fd = errno; @@ -1145,7 +1157,11 @@ BootStrapXLOG() CheckPoint checkPoint; XLogRecord *record; +#ifndef __CYGWIN__ fd = open(ControlFilePath, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); +#else + fd = open(ControlFilePath, O_RDWR|O_CREAT|O_EXCL|O_BINARY, S_IRUSR|S_IWUSR); +#endif if (fd < 0) elog(STOP, "BootStrapXLOG failed to create control file (%s): %d", ControlFilePath, errno); @@ -1249,7 +1265,11 @@ StartupXLOG() * Open/read Control file */ tryAgain: +#ifndef __CYGWIN__ fd = open(ControlFilePath, O_RDWR); +#else + fd = open(ControlFilePath, O_RDWR | O_BINARY); +#endif if (fd < 0 && (errno == EMFILE || errno == ENFILE)) { fd = errno; |