Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1f17316

Browse files
committed
Here is an updated version of the win32 readdir patch.
1) Now puts in exactly the same change as the current-cvs mingw code does. (see http://cvs.sourceforge.net/viewcvs.py/mingw/runtime/mingwex/dirent.c?r1= 1.3&r2=1.4, second part of the patch). 2) Updates both xlog.c and slru.c in backend/access/transam/ 3) Also updates pg_resetxlog, which also uses readdir() and checks the errno value after the loop. Magnus Hagander
1 parent ec6feaa commit 1f17316

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

src/backend/access/transam/slru.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.11 2004/02/10 01:55:24 tgl Exp $
9+
* $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.12 2004/02/17 03:45:17 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -917,6 +917,12 @@ SlruScanDirectory(SlruCtl ctl, int cutoffPage, bool doDeletions)
917917
}
918918
errno = 0;
919919
}
920+
#ifdef WIN32
921+
/* This fix is in mingw cvs (runtime/mingwex/dirent.c rev 1.4), but
922+
not in released version */
923+
if (GetLastError() == ERROR_NO_MORE_FILES)
924+
errno = 0;
925+
#endif
920926
if (errno)
921927
ereport(ERROR,
922928
(errcode_for_file_access(),

src/backend/access/transam/xlog.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.135 2004/02/11 22:55:24 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.136 2004/02/17 03:45:17 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1805,6 +1805,12 @@ MoveOfflineLogs(uint32 log, uint32 seg, XLogRecPtr endptr)
18051805
}
18061806
errno = 0;
18071807
}
1808+
#ifdef WIN32
1809+
/* This fix is in mingw cvs (runtime/mingwex/dirent.c rev 1.4), but
1810+
not in released version */
1811+
if (GetLastError() == ERROR_NO_MORE_FILES)
1812+
errno = 0;
1813+
#endif
18081814
if (errno)
18091815
ereport(PANIC,
18101816
(errcode_for_file_access(),

src/bin/pg_resetxlog/pg_resetxlog.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
2424
* Portions Copyright (c) 1994, Regents of the University of California
2525
*
26-
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.15 2004/02/11 22:55:25 tgl Exp $
26+
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.16 2004/02/17 03:45:17 momjian Exp $
2727
*
2828
*-------------------------------------------------------------------------
2929
*/
@@ -611,6 +611,12 @@ KillExistingXLOG(void)
611611
}
612612
errno = 0;
613613
}
614+
#ifdef WIN32
615+
/* This fix is in mingw cvs (runtime/mingwex/dirent.c rev 1.4), but
616+
not in released version */
617+
if (GetLastError() == ERROR_NO_MORE_FILES)
618+
errno = 0;
619+
#endif
614620

615621
if (errno)
616622
{

0 commit comments

Comments
 (0)