diff options
Diffstat (limited to 'Logs/Transfer.hs')
-rw-r--r-- | Logs/Transfer.hs | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/Logs/Transfer.hs b/Logs/Transfer.hs index 7928972b3..16c3ebb68 100644 --- a/Logs/Transfer.hs +++ b/Logs/Transfer.hs @@ -129,17 +129,12 @@ checkTransfer :: Transfer -> Annex (Maybe TransferInfo) checkTransfer t = do tfile <- fromRepo $ transferFile t #ifndef mingw32_HOST_OS - mfd <- liftIO $ openExistingLockFile (transferLockFile tfile) - case mfd of - Nothing -> return Nothing -- failed to open file; not running - Just fd -> do - locked <- liftIO $ - getLock fd (WriteLock, AbsoluteSeek, 0, 0) - liftIO $ closeFd fd - case locked of - Nothing -> return Nothing - Just (pid, _) -> liftIO $ catchDefaultIO Nothing $ - readTransferInfoFile (Just pid) tfile + liftIO $ do + v <- getLockStatus (transferLockFile tfile) + case v of + Just (pid, _) -> catchDefaultIO Nothing $ + readTransferInfoFile (Just pid) tfile + Nothing -> return Nothing #else v <- liftIO $ lockShared $ transferLockFile tfile liftIO $ case v of |