Fix data loss that can occur when annex.pidlock is set in a repository.

This commit is contained in:
Joey Hess 2016-03-01 12:12:57 -04:00
parent 2f48c0aa7c
commit 3e91cd13ba
Failed to extract signature
3 changed files with 20 additions and 2 deletions

View file

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