summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-08-25 17:24:46 +0200
committerVincent Petry <pvince81@owncloud.com>2014-08-25 17:24:46 +0200
commitc86824fa09b116e8d24ac5c3b0b72f5c4455f290 (patch)
treec3a17313890132ed26294e2314cedc74c4feac90
parent5e2f627d3d15a0635c6bc3718d6b80a711b2c5f4 (diff)
parent0113ad0b3310ff3d2259341885b4d2c7dc89610d (diff)
downloadnextcloud-server-c86824fa09b116e8d24ac5c3b0b72f5c4455f290.tar.gz
nextcloud-server-c86824fa09b116e8d24ac5c3b0b72f5c4455f290.zip
Merge pull request #10023 from owncloud/tmp-file-created-status
Log unsuccessful temp file creation and return false
-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 17d3840a3ea..7c1edd1b058 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -579,8 +579,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;
}