Skip to content

Commit 74888b9

Browse files
committed
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.
1 parent 9216c89 commit 74888b9

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/bin/initdb/initdb.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* Portions Copyright (c) 1994, Regents of the University of California
4343
* Portions taken from FreeBSD.
4444
*
45-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.93 2005/07/25 04:52:31 tgl Exp $
45+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.94 2005/08/02 15:16:27 tgl Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -930,7 +930,8 @@ check_data_dir(void)
930930

931931
while ((file = readdir(chkdir)) != NULL)
932932
{
933-
if (strcmp(".", file->d_name) == 0 || strcmp("..", file->d_name) == 0)
933+
if (strcmp(".", file->d_name) == 0 ||
934+
strcmp("..", file->d_name) == 0)
934935
{
935936
/* skip this and parent directory */
936937
continue;
@@ -942,6 +943,15 @@ check_data_dir(void)
942943
}
943944
}
944945

946+
#ifdef WIN32
947+
/*
948+
* This fix is in mingw cvs (runtime/mingwex/dirent.c rev 1.4), but
949+
* not in released version
950+
*/
951+
if (GetLastError() == ERROR_NO_MORE_FILES)
952+
errno = 0;
953+
#endif
954+
945955
closedir(chkdir);
946956

947957
if (errno != 0)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy