From: Victor Dubiniuk Date: Tue, 29 Jul 2014 15:18:15 +0000 (+0300) Subject: Log unsuccessful temp file creation and return false X-Git-Tag: v8.0.0alpha1~834^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0113ad0b3310ff3d2259341885b4d2c7dc89610d;p=nextcloud-server.git Log unsuccessful temp file creation and return false --- 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; }