mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-12 18:34:36 +08:00
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
This commit is contained in:
parent
6967e894fd
commit
c4e5ec592f
@ -6,7 +6,7 @@
|
||||
* copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
|
||||
* licence: BSD
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.31 2006/08/21 16:16:31 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.31.2.1 2008/09/24 08:59:44 mha Exp $
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
@ -106,7 +106,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));
|
||||
|
@ -23,7 +23,7 @@
|
||||
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.53 2006/10/04 00:30:05 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.53.2.1 2008/09/24 08:59:44 mha Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -366,7 +366,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
|
||||
|
Loading…
Reference in New Issue
Block a user