summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVictor Dubiniuk <victor.dubiniuk@gmail.com>2014-07-29 18:18:15 +0300
committerMorris Jobke <hey@morrisjobke.de>2014-07-30 13:50:41 +0200
commit0113ad0b3310ff3d2259341885b4d2c7dc89610d (patch)
tree24190a89ab3f88776a624e1943d88aad0ee91095 /lib
parent06d118d06c0def5a33aab64c6a2c20f79944b378 (diff)
downloadnextcloud-server-0113ad0b3310ff3d2259341885b4d2c7dc89610d.tar.gz
nextcloud-server-0113ad0b3310ff3d2259341885b4d2c7dc89610d.zip
Log unsuccessful temp file creation and return false
Diffstat (limited to 'lib')
-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;
}