From 0113ad0b3310ff3d2259341885b4d2c7dc89610d Mon Sep 17 00:00:00 2001 From: Victor Dubiniuk Date: Tue, 29 Jul 2014 18:18:15 +0300 Subject: [PATCH] Log unsuccessful temp file creation and return false --- lib/private/helper.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/private/helper.php b/lib/private/helper.php index f90c38d236c..8764a6b35d9 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -578,8 +578,20 @@ class OC_Helper { public static function tmpFile($postfix = '') { $file = get_temp_dir() . '/' . md5(time() . rand()) . $postfix; $fh = fopen($file, 'w'); - fclose($fh); - self::$tmpFiles[] = $file; + if ($fh!==false){ + fclose($fh); + self::$tmpFiles[] = $file; + } else { + OC_Log::write( + 'OC_Helper', + sprintf( + 'Can not create a temporary file in directory %s. Check it exists and has correct permissions', + get_temp_dir() + ), + OC_Log::WARN + ); + $file = false; + } return $file; } -- 2.39.5