Skip to content
Snippets Groups Projects
Commit 0113ad0b authored by Victor Dubiniuk's avatar Victor Dubiniuk Committed by Morris Jobke
Browse files

Log unsuccessful temp file creation and return false

parent 06d118d0
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment