diff options
author | Joey Hess <joey@kitenet.net> | 2014-08-20 16:45:58 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-08-20 16:45:58 -0400 |
commit | 679d9c0027ac996eea9f41a6f0f39af436801e89 (patch) | |
tree | d98ae7ba049e2daa4a99e6bcf55054bde5e5ab4d /Remote/Helper | |
parent | 86f9d7734d0c638d4c966fd87a5d7e97759e125b (diff) |
reorganize and refactor lock code
Added a convenience Utility.LockFile that is not a windows/posix
portability shim, but still manages to cut down on the boilerplate around
locking.
This commit was sponsored by Johan Herland.
Diffstat (limited to 'Remote/Helper')
-rw-r--r-- | Remote/Helper/Hooks.hs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Remote/Helper/Hooks.hs b/Remote/Helper/Hooks.hs index cd31a2fd5..96f73cce3 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,9 +83,7 @@ runHooks r starthook stophook a = do unlockFile lck #ifndef mingw32_HOST_OS mode <- annexFileMode - fd <- liftIO $ noUmask mode $ - openFd lck ReadWrite (Just mode) defaultFileFlags - liftIO $ setFdOption fd CloseOnExec True + fd <- liftIO $ noUmask mode $ createLockFile (Just mode) lck v <- liftIO $ tryIO $ setLock fd (WriteLock, AbsoluteSeek, 0, 0) case v of |