Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8fa8f80

Browse files
committed
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 (forinstance) is that "open( path, O_RDWR );" opens a file in text mode. Sosometime less block can be read than required.I suggest a following patch. BTW the situation appeared before, seehba.c, pqcomm.c and others.Alexei Zakharov
1 parent9606f36 commit8fa8f80

File tree

1 file changed

+21
-1
lines changed
  • src/backend/access/transam

1 file changed

+21
-1
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.10 2000/02/15 03:00:37 thomas Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.11 2000/03/07 23:49:31 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -726,7 +726,11 @@ XLogFileInit(uint32 log, uint32 seg)
726726
unlink(path);
727727

728728
tryAgain:
729+
#ifndef__CYGWIN__
729730
fd=open(path,O_RDWR|O_CREAT|O_EXCL,S_IRUSR|S_IWUSR);
731+
#else
732+
fd=open(path,O_RDWR|O_CREAT|O_EXCL|O_BINARY,S_IRUSR|S_IWUSR);
733+
#endif
730734
if (fd<0&& (errno==EMFILE||errno==ENFILE))
731735
{
732736
fd=errno;
@@ -767,7 +771,11 @@ XLogFileOpen(uint32 log, uint32 seg, bool econt)
767771
XLogFileName(path,log,seg);
768772

769773
tryAgain:
774+
#ifndef__CYGWIN__
770775
fd=open(path,O_RDWR);
776+
#else
777+
fd=open(path,O_RDWR |O_BINARY);
778+
#endif
771779
if (fd<0&& (errno==EMFILE||errno==ENFILE))
772780
{
773781
fd=errno;
@@ -1083,7 +1091,11 @@ UpdateControlFile()
10831091
intfd;
10841092

10851093
tryAgain:
1094+
#ifndef__CYGWIN__
10861095
fd=open(ControlFilePath,O_RDWR);
1096+
#else
1097+
fd=open(ControlFilePath,O_RDWR |O_BINARY);
1098+
#endif
10871099
if (fd<0&& (errno==EMFILE||errno==ENFILE))
10881100
{
10891101
fd=errno;
@@ -1145,7 +1157,11 @@ BootStrapXLOG()
11451157
CheckPointcheckPoint;
11461158
XLogRecord*record;
11471159

1160+
#ifndef__CYGWIN__
11481161
fd=open(ControlFilePath,O_RDWR|O_CREAT|O_EXCL,S_IRUSR|S_IWUSR);
1162+
#else
1163+
fd=open(ControlFilePath,O_RDWR|O_CREAT|O_EXCL|O_BINARY,S_IRUSR|S_IWUSR);
1164+
#endif
11491165
if (fd<0)
11501166
elog(STOP,"BootStrapXLOG failed to create control file (%s): %d",
11511167
ControlFilePath,errno);
@@ -1249,7 +1265,11 @@ StartupXLOG()
12491265
* Open/read Control file
12501266
*/
12511267
tryAgain:
1268+
#ifndef__CYGWIN__
12521269
fd=open(ControlFilePath,O_RDWR);
1270+
#else
1271+
fd=open(ControlFilePath,O_RDWR |O_BINARY);
1272+
#endif
12531273
if (fd<0&& (errno==EMFILE||errno==ENFILE))
12541274
{
12551275
fd=errno;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp