diff options
author | Björn Schießle <schiessle@owncloud.com> | 2013-02-22 14:56:50 +0100 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2013-02-22 14:56:50 +0100 |
commit | 5b949596867c986916568e5bea2003e04102aa71 (patch) | |
tree | 8a6f7b1cf2d7d98763b1fb35499f511530791909 /lib | |
parent | 51d050c93515215f5053113c617a4c49c4a4474e (diff) | |
download | nextcloud-server-5b949596867c986916568e5bea2003e04102aa71.tar.gz nextcloud-server-5b949596867c986916568e5bea2003e04102aa71.zip |
using the number of writen bytes as indicator if streamCopy() was successfully. Instead check if fwrite returns the number of bytes or false
Diffstat (limited to 'lib')
-rw-r--r-- | lib/files/view.php | 3 | ||||
-rw-r--r-- | lib/helper.php | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/files/view.php b/lib/files/view.php index 9ac08c98082..11edbadab9b 100644 --- a/lib/files/view.php +++ b/lib/files/view.php @@ -361,10 +361,9 @@ class View { } else { $source = $this->fopen($path1 . $postFix1, 'r'); $target = $this->fopen($path2 . $postFix2, 'w'); - $count = \OC_Helper::streamCopy($source, $target); + $result = \OC_Helper::streamCopy($source, $target); list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1); $storage1->unlink($internalPath1); - $result = $count > 0; } if ($this->fakeRoot == Filesystem::getRoot()) { \OC_Hook::emit( diff --git a/lib/helper.php b/lib/helper.php index add5c66e7be..2c9cd36b199 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -513,11 +513,13 @@ class OC_Helper { if(!$source or !$target) { return false; } - $count=0; + $result=true; while(!feof($source)) { - $count+=fwrite($target, fread($source, 8192)); + if (fwrite($target, fread($source, 8192)) === false) { + $result = false; + } } - return $count; + return $result; } /** |