mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-14 10:13:05 +02:00
Create log directories/files with 0750/0640 mode.
The log directories/files were being created with a mix of modes depending on whether they were created in C or Perl. In particular, the C code was creating log files with the execute bit set for the user and group which was just odd. Standardize on 750/640 for both code paths. Suggested by Damiano Albani.
This commit is contained in:
parent
bc5385142c
commit
41b6795a37
@ -22,6 +22,14 @@
|
||||
|
||||
<p>The <cmd>start</cmd>/<cmd>stop</cmd> commands are implemented entirely in C.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<release-item-contributor-list>
|
||||
<release-item-ideator id="damiano.albani"/>
|
||||
</release-item-contributor-list>
|
||||
|
||||
<p>Create log directories/files with <id>0750</id>/<id>0640</id> mode.</p>
|
||||
</release-item>
|
||||
</release-improvement-list>
|
||||
</release-core-list>
|
||||
</release>
|
||||
@ -7272,6 +7280,11 @@
|
||||
<contributor-id type="github">cmwshang</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="damiano.albani">
|
||||
<contributor-name-display>Damiano Albani</contributor-name-display>
|
||||
<contributor-id type="github">dalbani</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="dan.farrell">
|
||||
<contributor-name-display>Dan Farrell</contributor-name-display>
|
||||
<contributor-id type="github">farrellit</contributor-id>
|
||||
|
@ -130,13 +130,13 @@ sub logFileSet
|
||||
# Only open the log file if file logging is enabled
|
||||
if ($strLogLevelFile ne OFF)
|
||||
{
|
||||
$oStorage->pathCreate(dirname($strFile), {strMode => '0770', bIgnoreExists => true, bCreateParent => true});
|
||||
$oStorage->pathCreate(dirname($strFile), {strMode => '0750', bIgnoreExists => true, bCreateParent => true});
|
||||
|
||||
$strFile .= '.log';
|
||||
$bLogFileExists = -e $strFile ? true : false;
|
||||
$bLogFileFirst = defined($bLogFileFirstParam) ? $bLogFileFirstParam : false;
|
||||
|
||||
if (!sysopen($hLogFile, $strFile, O_WRONLY | O_CREAT | O_APPEND, oct('0660')))
|
||||
if (!sysopen($hLogFile, $strFile, O_WRONLY | O_CREAT | O_APPEND, oct('0640')))
|
||||
{
|
||||
logErrorResult(ERROR_FILE_OPEN, "unable to open log file '${strFile}'", $OS_ERROR);
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ logFileSet(const char *logFile)
|
||||
if (logLevelFile != logLevelOff)
|
||||
{
|
||||
// Open the file and handle errors
|
||||
logHandleFile = open(logFile, O_CREAT | O_APPEND | O_WRONLY, 0750);
|
||||
logHandleFile = open(logFile, O_CREAT | O_APPEND | O_WRONLY, 0640);
|
||||
|
||||
if (logHandleFile == -1)
|
||||
{
|
||||
|
@ -5475,13 +5475,13 @@ static const EmbeddedModule embeddedModule[] =
|
||||
"\n\n"
|
||||
"if ($strLogLevelFile ne OFF)\n"
|
||||
"{\n"
|
||||
"$oStorage->pathCreate(dirname($strFile), {strMode => '0770', bIgnoreExists => true, bCreateParent => true});\n"
|
||||
"$oStorage->pathCreate(dirname($strFile), {strMode => '0750', bIgnoreExists => true, bCreateParent => true});\n"
|
||||
"\n"
|
||||
"$strFile .= '.log';\n"
|
||||
"$bLogFileExists = -e $strFile ? true : false;\n"
|
||||
"$bLogFileFirst = defined($bLogFileFirstParam) ? $bLogFileFirstParam : false;\n"
|
||||
"\n"
|
||||
"if (!sysopen($hLogFile, $strFile, O_WRONLY | O_CREAT | O_APPEND, oct('0660')))\n"
|
||||
"if (!sysopen($hLogFile, $strFile, O_WRONLY | O_CREAT | O_APPEND, oct('0640')))\n"
|
||||
"{\n"
|
||||
"logErrorResult(ERROR_FILE_OPEN, \"unable to open log file '${strFile}'\", $OS_ERROR);\n"
|
||||
"}\n"
|
||||
|
Loading…
Reference in New Issue
Block a user