summaryrefslogtreecommitdiffstats
path: root/lib/private/helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/helper.php')
-rw-r--r--lib/private/helper.php16
1 files 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;
}