diff options
author | Magnus Hagander | 2008-09-24 08:59:46 +0000 |
---|---|---|
committer | Magnus Hagander | 2008-09-24 08:59:46 +0000 |
commit | 7da7f1ec92e597d9c01e9b11a2d57b0886bfa3be (patch) | |
tree | 55fe97fdc7f6b2e2c0054f8eb52999b8d512fd9e | |
parent | de1986bdc129b4688d94a8bef35154700b761057 (diff) |
Make sure pg_control is opened in binary mode, to deal
with situtations when the file contains an EOF maker
(0x1A) on Windows.
ITAGAKI Takahiro
-rw-r--r-- | src/bin/pg_controldata/pg_controldata.c | 2 | ||||
-rw-r--r-- | src/bin/pg_resetxlog/pg_resetxlog.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c index 08e102f391..bdbedfd99e 100644 --- a/src/bin/pg_controldata/pg_controldata.c +++ b/src/bin/pg_controldata/pg_controldata.c @@ -107,7 +107,7 @@ main(int argc, char *argv[]) snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir); - if ((fd = open(ControlFilePath, O_RDONLY, 0)) == -1) + if ((fd = open(ControlFilePath, O_RDONLY | PG_BINARY, 0)) == -1) { fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"), progname, ControlFilePath, strerror(errno)); diff --git a/src/bin/pg_resetxlog/pg_resetxlog.c b/src/bin/pg_resetxlog/pg_resetxlog.c index 0df796b680..22e9e7213f 100644 --- a/src/bin/pg_resetxlog/pg_resetxlog.c +++ b/src/bin/pg_resetxlog/pg_resetxlog.c @@ -373,7 +373,7 @@ ReadControlFile(void) char *buffer; pg_crc32 crc; - if ((fd = open(XLOG_CONTROL_FILE, O_RDONLY, 0)) < 0) + if ((fd = open(XLOG_CONTROL_FILE, O_RDONLY | PG_BINARY, 0)) < 0) { /* * If pg_control is not there at all, or we can't read it, the odds |