aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-08-02 15:16:27 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-08-02 15:16:27 +0000
commit74888b93490ea7c4f70fafba196bb4ad2891c259 (patch)
treee968d3bf8029e32632527d40063d91aa18208daf
parent9216c8999affbb2df78173665a215f4b3198de48 (diff)
downloadpostgresql-74888b93490ea7c4f70fafba196bb4ad2891c259.tar.gz
postgresql-74888b93490ea7c4f70fafba196bb4ad2891c259.zip
Add ERROR_NO_MORE_FILES workaround to check_data_dir(). This may or
may not be obsolete, but since every other readdir loop in our code has it, I think this should too.
-rw-r--r--src/bin/initdb/initdb.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 46cb106b134..5c77a87005c 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -42,7 +42,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.93 2005/07/25 04:52:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.94 2005/08/02 15:16:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -930,7 +930,8 @@ check_data_dir(void)
while ((file = readdir(chkdir)) != NULL)
{
- if (strcmp(".", file->d_name) == 0 || strcmp("..", file->d_name) == 0)
+ if (strcmp(".", file->d_name) == 0 ||
+ strcmp("..", file->d_name) == 0)
{
/* skip this and parent directory */
continue;
@@ -942,6 +943,15 @@ check_data_dir(void)
}
}
+#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
+
closedir(chkdir);
if (errno != 0)