current-logfiles-perm-v4.patch
text/x-diff
Filename: current-logfiles-perm-v4.patch
Type: text/x-diff
Part: 0
Patch
Format: unified
Series: patch v4
| File | + | − |
|---|---|---|
| src/backend/postmaster/syslogger.c | 8 | 1 |
diff --git a/src/backend/postmaster/syslogger.c b/src/backend/postmaster/syslogger.c
index d1ea46deb8..d1f71c0f7e 100644
--- a/src/backend/postmaster/syslogger.c
+++ b/src/backend/postmaster/syslogger.c
@@ -31,6 +31,7 @@
#include <sys/stat.h>
#include <sys/time.h>
+#include "common/file_perm.h"
#include "lib/stringinfo.h"
#include "libpq/pqsignal.h"
#include "miscadmin.h"
@@ -1453,6 +1454,7 @@ static void
update_metainfo_datafile(void)
{
FILE *fh;
+ mode_t oumask;
if (!(Log_destination & LOG_DESTINATION_STDERR) &&
!(Log_destination & LOG_DESTINATION_CSVLOG))
@@ -1465,7 +1467,12 @@ update_metainfo_datafile(void)
return;
}
- if ((fh = logfile_open(LOG_METAINFO_DATAFILE_TMP, "w", true)) == NULL)
+ /* use the same permissions as the data directory for the new file */
+ oumask = umask(pg_mode_mask);
+ fh = fopen(LOG_METAINFO_DATAFILE_TMP, "w");
+ umask(oumask);
+
+ if (fh == NULL)
{
ereport(LOG,
(errcode_for_file_access(),