summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/file_perm.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/common/file_perm.c b/src/common/file_perm.c
index 60f88d2caf1..81464f939ca 100644
--- a/src/common/file_perm.c
+++ b/src/common/file_perm.c
@@ -59,12 +59,12 @@ SetDataDirectoryCreatePerm(int dataDirMode)
* false is returned.
*
* Suppress when on Windows, because there may not be proper support for Unix-y
- * file permissions.
+ * file permissions. But we still run stat() on the directory so that callers
+ * get consistent behavior for example if the directory does not exist.
*/
bool
GetDataDirectoryCreatePerm(const char *dataDir)
{
-#if !defined(WIN32) && !defined(__CYGWIN__)
struct stat statBuf;
/*
@@ -75,16 +75,12 @@ GetDataDirectoryCreatePerm(const char *dataDir)
if (stat(dataDir, &statBuf) == -1)
return false;
+#if !defined(WIN32) && !defined(__CYGWIN__)
/* Set permissions */
SetDataDirectoryCreatePerm(statBuf.st_mode);
- return true;
-#else /* !defined(WIN32) && !defined(__CYGWIN__) */
- /*
- * On Windows, we don't have anything to do here since they don't have
- * Unix-y permissions.
- */
- return true;
#endif
+
+ return true;
}