Merge pull request #22208 from nextcloud/backport/21676/stable19

[stable19] Fix chmod on file descriptor
This commit is contained in:
Roeland Jago Douma 2020-08-13 05:17:13 +02:00 committed by GitHub
commit fe8ea5390f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -82,7 +82,7 @@ class File extends LogDetails implements IWriter, IFileBased {
public function write(string $app, $message, int $level) { public function write(string $app, $message, int $level) {
$entry = $this->logDetailsAsJSON($app, $message, $level); $entry = $this->logDetailsAsJSON($app, $message, $level);
$handle = @fopen($this->logFile, 'a'); $handle = @fopen($this->logFile, 'a');
if ($this->logFileMode > 0 && (fileperms($this->logFile) & 0777) != $this->logFileMode) { if ($this->logFileMode > 0 && is_file($this->logFile) && (fileperms($this->logFile) & 0777) != $this->logFileMode) {
@chmod($this->logFile, $this->logFileMode); @chmod($this->logFile, $this->logFileMode);
} }
if ($handle) { if ($handle) {