summaryrefslogtreecommitdiff
path: root/Remote/Helper
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-09-18 14:36:20 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-09-18 14:36:20 -0400
commit2ba86dcb3dd049f592235bcbcb45a6f05c2a13f6 (patch)
treed5cccc978e7b4bf5171a93c7cb5a314b891bb6b8 /Remote/Helper
parentb9343ca1d3e0c7e136f7894cd159edb1d0730a0a (diff)
parent7255a3267c3728822698aafcf5b9d597b17dc9a4 (diff)
Merge branch 'master' into s3-aws
Conflicts: Utility/Url.hs debian/changelog git-annex.cabal
Diffstat (limited to 'Remote/Helper')
-rw-r--r--Remote/Helper/Hooks.hs14
1 files changed, 3 insertions, 11 deletions
diff --git a/Remote/Helper/Hooks.hs b/Remote/Helper/Hooks.hs
index 907400bd1..529c35d3f 100644
--- a/Remote/Helper/Hooks.hs
+++ b/Remote/Helper/Hooks.hs
@@ -16,10 +16,9 @@ import Types.Remote
import Types.CleanupActions
import qualified Annex
import Annex.LockFile
+import Utility.LockFile
#ifndef mingw32_HOST_OS
import Annex.Perms
-#else
-import Utility.WinLock
#endif
{- Modifies a remote's access functions to first run the
@@ -84,19 +83,12 @@ runHooks r starthook stophook a = do
unlockFile lck
#ifndef mingw32_HOST_OS
mode <- annexFileMode
- fd <- liftIO $ noUmask mode $
- openFd lck ReadWrite (Just mode) defaultFileFlags
- v <- liftIO $ tryIO $
- setLock fd (WriteLock, AbsoluteSeek, 0, 0)
- case v of
- Left _ -> noop
- Right _ -> run stophook
- liftIO $ closeFd fd
+ v <- liftIO $ noUmask mode $ tryLockExclusive (Just mode) lck
#else
v <- liftIO $ lockExclusive lck
+#endif
case v of
Nothing -> noop
Just lockhandle -> do
run stophook
liftIO $ dropLock lockhandle
-#endif