From 6e618300ecd5c37aa169120f7a9ee66d8814c405 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 26 Nov 2015 12:13:02 +0100 Subject: [PATCH] Guard the FileCache if the systemd private tmp directory for the web server has been removed refs #10123 --- library/Icinga/Web/FileCache.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library/Icinga/Web/FileCache.php b/library/Icinga/Web/FileCache.php index f36438cb6..96f3775d0 100644 --- a/library/Icinga/Web/FileCache.php +++ b/library/Icinga/Web/FileCache.php @@ -44,13 +44,15 @@ class FileCache $tmpDir = sys_get_temp_dir(); $runtimePath = $tmpDir . '/FileCache_' . $name; if (is_dir($runtimePath)) { - // Don't combine the following if with the above because else mkdir may fail w/ file exists if the runtime - // path exists and is not writeable + // Don't combine the following if with the above because else the elseif path will be evaluated if the + // runtime path exists and is not writeable if (is_writeable($runtimePath)) { $this->basedir = $runtimePath; $this->enabled = true; } - } elseif (is_dir($tmpDir) && is_writeable($tmpDir) && mkdir($runtimePath, '0750', true)) { + } elseif (is_dir($tmpDir) && is_writeable($tmpDir) && @mkdir($runtimePath, '0750', true)) { + // Suppress mkdir errors because it may error w/ no such file directory if the systemd private tmp directory + // for the web server has been removed $this->basedir = $runtimePath; $this->enabled = true; }