[Pkg-owncloud-commits] [owncloud] 125/258: Log unsuccessful temp file creation and return false

David Prévot taffit at moszumanska.debian.org
Sat Oct 11 17:22:28 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit b3ddd39438ad5fffa53a5ec909269e7ac467980c
Author: Victor Dubiniuk <victor.dubiniuk at gmail.com>
Date:   Tue Jul 29 18:18:15 2014 +0300

    Log unsuccessful temp file creation and return false
---
 lib/private/helper.php | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/lib/private/helper.php b/lib/private/helper.php
index f90c38d..8764a6b 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;
 	}
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list