Fix EXEC BACKEND + Windows builds for group privs
authorStephen Frost <sfrost@snowman.net>
Sat, 7 Apr 2018 23:01:43 +0000 (19:01 -0400)
committerStephen Frost <sfrost@snowman.net>
Sat, 7 Apr 2018 23:01:43 +0000 (19:01 -0400)
Under EXEC BACKEND we also need to be going through the group privileges
setup since we do support that on Unixy systems, so add that to
SubPostmasterMain().

Under Windows, we need to simply return true from
GetDataDirectoryCreatePerm(), but that wasn't happening due to a missing
 #else clause.

Per buildfarm.

src/backend/postmaster/postmaster.c
src/common/file_perm.c

index ccf63e93097f3d062c826f73103ede0b69b54cfc..d948369f3eaaf27bd6020f62d11a519e4710f9ae 100644 (file)
@@ -4801,6 +4801,14 @@ SubPostmasterMain(int argc, char *argv[])
    /* Read in remaining GUC variables */
    read_nondefault_variables();
 
+   /*
+    * Check that the data directory looks valid, which will also check the
+    * privileges on the data directory and update our umask and file/group
+    * variables for creating files later.  Note: this should really be done
+    * before we create any files or directories.
+    */
+   checkDataDir();
+
    /*
     * (re-)read control file, as it contains config. The postmaster will
     * already have read this, but this process doesn't know about that.
index d640d6a1fdd66c8f81ccff52db0c2c0338c11ac4..f2c8f84609390472af412fbd063cda470e09eefb 100644 (file)
@@ -78,9 +78,14 @@ GetDataDirectoryCreatePerm(const char *dataDir)
 
    /* Set permissions */
    SetDataDirectoryCreatePerm(statBuf.st_mode);
-
    return true;
-#endif                         /* !defined(WIN32) && !defined(__CYGWIN__) */
+#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
 }