summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-11-21 01:22:05 -0800
committerVincent Petry <pvince81@owncloud.com>2013-11-21 01:22:05 -0800
commit391f267d380f0d098d730d3bc74633192cc13570 (patch)
treee19f3cd4de99067c4fde65d41fa7a38454b19878 /apps/files_external
parent19af45c7d14f1311b5b381e407abda7cb4f649a5 (diff)
parent3e2d4c1bc1cb7c9d8e93848cfdc23491fd4e85f7 (diff)
downloadnextcloud-server-391f267d380f0d098d730d3bc74633192cc13570.tar.gz
nextcloud-server-391f267d380f0d098d730d3bc74633192cc13570.zip
Merge pull request #5897 from hkjolhede/master
Fixed error-checking error in sftp.php
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/lib/sftp.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/apps/files_external/lib/sftp.php b/apps/files_external/lib/sftp.php
index fb1ecd54635..7c5aed5aa06 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() {