summaryrefslogtreecommitdiff
path: root/Annex/Ssh.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Annex/Ssh.hs')
-rw-r--r--Annex/Ssh.hs11
1 files changed, 5 insertions, 6 deletions
diff --git a/Annex/Ssh.hs b/Annex/Ssh.hs
index 2b1b809ff..ad636b4aa 100644
--- a/Annex/Ssh.hs
+++ b/Annex/Ssh.hs
@@ -152,13 +152,12 @@ sshCleanup = mapM_ cleanup =<< enumSocketFiles
let lockfile = socket2lock socketfile
unlockFile lockfile
mode <- annexFileMode
- fd <- liftIO $ noUmask mode $ createLockFile (Just mode) lockfile
- v <- liftIO $ tryIO $
- setLock fd (WriteLock, AbsoluteSeek, 0, 0)
+ v <- liftIO $ noUmask mode $ tryLockExclusive (Just mode) lockfile
case v of
- Left _ -> noop
- Right _ -> forceStopSsh socketfile
- liftIO $ closeFd fd
+ Nothing -> noop
+ Just lck -> do
+ forceStopSsh socketfile
+ liftIO $ dropLock lck
#else
forceStopSsh socketfile
#endif