]> granicus.if.org Git - postgresql/commitdiff
Here is an updated version of the win32 readdir patch.
authorBruce Momjian <bruce@momjian.us>
Tue, 17 Feb 2004 03:45:17 +0000 (03:45 +0000)
committerBruce Momjian <bruce@momjian.us>
Tue, 17 Feb 2004 03:45:17 +0000 (03:45 +0000)
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

src/backend/access/transam/slru.c
src/backend/access/transam/xlog.c
src/bin/pg_resetxlog/pg_resetxlog.c

index c92f90f6ca83c70cce12aac1f335e0418fccbcfa..aac93a60a3f7dbd1bcbb58fa8d6a38a5e659dba3 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.11 2004/02/10 01:55:24 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.12 2004/02/17 03:45:17 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -917,6 +917,12 @@ SlruScanDirectory(SlruCtl ctl, int cutoffPage, bool doDeletions)
                }
                errno = 0;
        }
+#ifdef WIN32
+       /* This fix is in mingw cvs (runtime/mingwex/dirent.c rev 1.4), but
+          not in released version */
+       if (GetLastError() == ERROR_NO_MORE_FILES)
+               errno = 0;
+#endif
        if (errno)
                ereport(ERROR,
                                (errcode_for_file_access(),
index c0e328bf619555eb2ab319d5b0b18a2912516af7..dc6fea9b5bb9ebc85bf9ba57344345997e36dc30 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.135 2004/02/11 22:55:24 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.136 2004/02/17 03:45:17 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1805,6 +1805,12 @@ MoveOfflineLogs(uint32 log, uint32 seg, XLogRecPtr endptr)
                }
                errno = 0;
        }
+#ifdef WIN32
+       /* This fix is in mingw cvs (runtime/mingwex/dirent.c rev 1.4), but
+          not in released version */
+       if (GetLastError() == ERROR_NO_MORE_FILES)
+               errno = 0;
+#endif
        if (errno)
                ereport(PANIC,
                                (errcode_for_file_access(),
index 9049aed099d4084c47a3b618a76c2fd3ea9ea645..d97948185fed735698a8010f02a91324d589194f 100644 (file)
@@ -23,7 +23,7 @@
  * Portions Copyright (c) 1996-2003, 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.15 2004/02/11 22:55:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.16 2004/02/17 03:45:17 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -611,6 +611,12 @@ KillExistingXLOG(void)
                }
                errno = 0;
        }
+#ifdef WIN32
+       /* This fix is in mingw cvs (runtime/mingwex/dirent.c rev 1.4), but
+          not in released version */
+       if (GetLastError() == ERROR_NO_MORE_FILES)
+               errno = 0;
+#endif
 
        if (errno)
        {