summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
Diffstat (limited to 'Annex')
-rw-r--r--Annex/LockPool/PosixOrPid.hs12
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