diff options
Diffstat (limited to 'src/port/pgcheckdir.c')
-rw-r--r-- | src/port/pgcheckdir.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/port/pgcheckdir.c b/src/port/pgcheckdir.c index 3b8258c0353..aee59975afc 100644 --- a/src/port/pgcheckdir.c +++ b/src/port/pgcheckdir.c @@ -31,6 +31,7 @@ pg_check_dir(const char *dir) int result = 1; DIR *chkdir; struct dirent *file; + bool dot_found = false; errno = 0; @@ -47,15 +48,26 @@ pg_check_dir(const char *dir) /* skip this and parent directory */ continue; } +#ifndef WIN32 + /* file starts with "." */ + else if (file->d_name[0] == '.') + { + dot_found = true; + } + else if (strcmp("lost+found", file->d_name) == 0) + { + result = 3; /* not empty, mount point */ + break; + } +#endif else { - result = 2; /* not empty */ + result = 4; /* not empty */ break; } } #ifdef WIN32 - /* * This fix is in mingw cvs (runtime/mingwex/dirent.c rev 1.4), but not in * released version @@ -69,5 +81,9 @@ pg_check_dir(const char *dir) if (errno != 0) result = -1; /* some kind of I/O error? */ + /* We report on dot-files if we _only_ find dot files */ + if (result == 1 && dot_found) + result = 2; + return result; } |