[Pkg-owncloud-commits] [owncloud] 12/239: Fixed error-checking error in sftp.php

David Prévot taffit at moszumanska.debian.org
Fri Nov 29 01:32:11 UTC 2013


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

taffit pushed a commit to branch master
in repository owncloud.

commit 3e2d4c1bc1cb7c9d8e93848cfdc23491fd4e85f7
Author: hkjolhede <hkjolhede at gmail.com>
Date:   Fri Nov 15 21:10:09 2013 +0100

    Fixed error-checking error in sftp.php
---
 apps/files_external/lib/sftp.php | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/apps/files_external/lib/sftp.php b/apps/files_external/lib/sftp.php
index fb1ecd5..7c5aed5 100644
--- a/apps/files_external/lib/sftp.php
+++ b/apps/files_external/lib/sftp.php
@@ -94,15 +94,17 @@ class SFTP extends \OC\Files\Storage\Common {
 	private function writeHostKeys($keys) {
 		try {
 			$keyPath = $this->hostKeysPath();
-			$fp = fopen($keyPath, 'w');
-			foreach ($keys as $host => $key) {
-				fwrite($fp, $host . '::' . $key . "\n");
+			if ($keyPath && file_exists($keyPath)) {
+				$fp = fopen($keyPath, 'w');
+				foreach ($keys as $host => $key) {
+					fwrite($fp, $host . '::' . $key . "\n");
+				}
+				fclose($fp);
+				return true;
 			}
-			fclose($fp);
-			return true;
 		} catch (\Exception $e) {
-			return false;
 		}
+		return false;
 	}
 
 	private function readHostKeys() {

-- 
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