1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-03 20:02:46 +03:00

Use symbolic names not octal constants for file permission flags.

Purely cosmetic patch to make our coding standards more consistent ---
we were doing symbolic some places and octal other places.  This patch
fixes all C-coded uses of mkdir, chmod, and umask.  There might be some
other calls I missed.  Inconsistency noted while researching tablespace
directory permissions issue.
This commit is contained in:
Tom Lane
2010-12-10 17:35:33 -05:00
parent 244407a710
commit 04f4e10cfc
10 changed files with 24 additions and 23 deletions

View File

@ -73,7 +73,7 @@ int Log_RotationSize = 10 * 1024;
char *Log_directory = NULL;
char *Log_filename = NULL;
bool Log_truncate_on_rotation = false;
int Log_file_mode = 0600;
int Log_file_mode = S_IRUSR | S_IWUSR;
/*
* Globally visible state (used by elog.c)
@ -511,7 +511,7 @@ SysLogger_Start(void)
/*
* Create log directory if not present; ignore errors
*/
mkdir(Log_directory, 0700);
mkdir(Log_directory, S_IRWXU);
/*
* The initial logfile is created right in the postmaster, to verify that
@ -1020,7 +1020,7 @@ logfile_open(const char *filename, const char *mode, bool allow_errors)
* Note we do not let Log_file_mode disable IWUSR, since we certainly
* want to be able to write the files ourselves.
*/
oumask = umask((mode_t) ((~(Log_file_mode | S_IWUSR)) & 0777));
oumask = umask((mode_t) ((~(Log_file_mode | S_IWUSR)) & (S_IRWXU | S_IRWXG | S_IRWXO)));
fh = fopen(filename, mode);
umask(oumask);