]> source.dussan.org Git - nextcloud-server.git/commitdiff
Log unsuccessful temp file creation and return false
authorVictor Dubiniuk <victor.dubiniuk@gmail.com>
Tue, 29 Jul 2014 15:18:15 +0000 (18:18 +0300)
committerMorris Jobke <hey@morrisjobke.de>
Wed, 30 Jul 2014 11:50:41 +0000 (13:50 +0200)
lib/private/helper.php

index f90c38d236cc477538e9f059ef3df8c6f416fbf2..8764a6b35d97e8b9ff211f6e6e79b64a145c5ce9 100644 (file)
@@ -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;
        }