Ensure postgresql.auto.conf is created with correct permissions

This commit is contained in:
Ian Barwick
2019-10-18 16:45:46 +09:00
parent 5bf05f7b2d
commit 4f0613cba2

View File

@@ -1882,6 +1882,8 @@ modify_auto_conf(const char *data_dir, KeyValueList *items)
PQExpBufferData auto_conf_contents;
FILE *fp;
mode_t um;
KeyValueList config = {NULL, NULL};
KeyValueListCell *cell = NULL;
@@ -1937,7 +1939,11 @@ modify_auto_conf(const char *data_dir, KeyValueList *items)
cell->key, cell->value);
}
/* Set umask to 0600 */
um = umask((~(S_IRUSR | S_IWUSR)) & (S_IRWXG | S_IRWXO));
fp = fopen(auto_conf_tmp.data, "w");
umask(um);
if (fp == NULL)
{
fprintf(stderr, "unable to open \"%s\": %s\n",