[Pkg-owncloud-commits] [owncloud] 223/457: unlock source file when we cant lock the target in a rename

David Prévot taffit at moszumanska.debian.org
Sun Jun 28 20:06:11 UTC 2015


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

taffit pushed a commit to branch stable8
in repository owncloud.

commit 437c0b55a625ce3c2c6a81740fda8cb7a0bf1998
Author: Robin Appelman <icewind at owncloud.com>
Date:   Fri May 22 13:43:44 2015 +0200

    unlock source file when we cant lock the target in a rename
---
 lib/private/files/view.php | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index db904e5..d6cc62d 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -49,6 +49,7 @@ use OCP\Files\InvalidCharacterInPathException;
 use OCP\Files\InvalidPathException;
 use OCP\Files\ReservedWordException;
 use OCP\Lock\ILockingProvider;
+use OCP\Lock\LockedException;
 
 /**
  * Class to provide access to ownCloud filesystem via a "view", and methods for
@@ -638,7 +639,12 @@ class View {
 				$internalPath2 = $mount2->getInternalPath($absolutePath2);
 
 				$this->lockFile($path1, ILockingProvider::LOCK_EXCLUSIVE);
-				$this->lockFile($path2, ILockingProvider::LOCK_EXCLUSIVE);
+				try {
+					$this->lockFile($path2, ILockingProvider::LOCK_EXCLUSIVE);
+				} catch (LockedException $e) {
+					$this->unlockFile($path1, ILockingProvider::LOCK_EXCLUSIVE);
+					throw $e;
+				}
 
 				if ($internalPath1 === '' and $mount1 instanceof MoveableMount) {
 					if ($this->isTargetAllowed($absolutePath2)) {

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