]> source.dussan.org Git - nextcloud-server.git/commitdiff
Do not try to close the same resource multiple times
authorJoas Schilling <nickvergessen@gmx.de>
Mon, 25 Aug 2014 13:31:43 +0000 (15:31 +0200)
committerJoas Schilling <nickvergessen@gmx.de>
Mon, 25 Aug 2014 13:31:43 +0000 (15:31 +0200)
lib/private/files/view.php

index 1037056b0fb1eb86468d0f6a3bc3b916ebf18fba..d310a0fa4e1fcd538028f1c8a79b2ebafc6097fd 100644 (file)
@@ -670,7 +670,12 @@ class View {
                        $source = fopen($tmpFile, 'r');
                        if ($source) {
                                $this->file_put_contents($path, $source);
-                               fclose($source);
+                               // $this->file_put_contents() might have already closed
+                               // the resource, so we check it, before trying to close it
+                               // to avoid messages in the error log.
+                               if (is_resource($source)) {
+                                       fclose($source);
+                               }
                                unlink($tmpFile);
                                return true;
                        } else {