diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-03-03 15:40:25 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-03-03 15:40:25 -0400 |
commit | 3d9a971e66e3485da1da7895c4003f044bee65fd (patch) | |
tree | 433da059ce6e3aeacf46cbd856b6375384440c28 /Annex | |
parent | 7a2d72b7c7eb8d6879b4f3a94b2d14df0bf86d67 (diff) | |
parent | a717e1cc45f7a35b6b53787205f6e92bd0d01779 (diff) |
Merge branch 'master' into adjustedbranch
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/LockPool/PosixOrPid.hs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Annex/LockPool/PosixOrPid.hs b/Annex/LockPool/PosixOrPid.hs index ecf96d51f..c788f6fa0 100644 --- a/Annex/LockPool/PosixOrPid.hs +++ b/Annex/LockPool/PosixOrPid.hs @@ -47,8 +47,14 @@ tryLockExclusive :: Maybe FileMode -> LockFile -> Annex (Maybe LockHandle) tryLockExclusive m f = tryPidLock m f $ Posix.tryLockExclusive m f checkLocked :: LockFile -> Annex (Maybe Bool) -checkLocked f = Posix.checkLocked f - `pidLockCheck` Pid.checkLocked +checkLocked f = Posix.checkLocked f `pidLockCheck` checkpid + where + checkpid pidlock = do + v <- Pid.checkLocked pidlock + case v of + -- Only return true when the posix lock file exists. + Just _ -> Posix.checkLocked f + Nothing -> return Nothing getLockStatus :: LockFile -> Annex LockStatus getLockStatus f = Posix.getLockStatus f @@ -88,6 +94,6 @@ tryPidLock m f posixlock = liftIO . go =<< pidLockFile -- The posix lock file is created even when using pid locks, in order to -- avoid complicating any code that might expect to be able to see that --- lock file. +-- lock file. But, it's not locked. dummyPosixLock :: Maybe FileMode -> LockFile -> IO () dummyPosixLock m f = closeFd =<< openLockFile ReadLock m f |