1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Properly check for readdir/closedir() failures

Clear errno before calling readdir() and handle old MinGW errno bug
while adding full test coverage for readdir/closedir failures.

Backpatch through 8.4.
This commit is contained in:
Bruce Momjian
2014-03-21 13:45:11 -04:00
parent 473194c09c
commit ee42d8f10b
9 changed files with 109 additions and 68 deletions

View File

@ -1746,11 +1746,7 @@ ReadDir(DIR *dir, const char *dirname)
return dent;
#ifdef WIN32
/*
* This fix is in mingw cvs (runtime/mingwex/dirent.c rev 1.4), but not in
* released version
*/
/* Bug in old Mingw dirent.c; fixed in mingw-runtime-3.2, 2003-10-10 */
if (GetLastError() == ERROR_NO_MORE_FILES)
errno = 0;
#endif