diff options
author | Joey Hess <joey@kitenet.net> | 2014-08-20 11:25:07 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-08-20 11:37:02 -0400 |
commit | 092041fab0be19d9ba731182cef40ecc707a7cf3 (patch) | |
tree | 8c14d0ddbf835513ad4a5beca102526ab2fbb0d4 /Remote/Helper | |
parent | dfec2ffb22138544587626a2dcd58701f466658e (diff) |
Ensure that all lock fds are close-on-exec, fixing various problems with them being inherited by child processes such as git commands.
(With the exception of daemon pid locking.)
This fixes at part of #758630. I reproduced the assistant locking eg, a
removable drive's annex journal lock file and forking a long-running
git-cat-file process that inherited that lock.
This did not affect Windows.
Considered doing a portable Utility.LockFile layer, but git-annex uses
posix locks in several special ways that have no direct Windows equivilant,
and it seems like it would mostly be a complication.
This commit was sponsored by Protonet.
Diffstat (limited to 'Remote/Helper')
-rw-r--r-- | Remote/Helper/Hooks.hs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Remote/Helper/Hooks.hs b/Remote/Helper/Hooks.hs index 907400bd1c..150e9efd28 100644 --- a/Remote/Helper/Hooks.hs +++ b/Remote/Helper/Hooks.hs @@ -86,6 +86,7 @@ runHooks r starthook stophook a = do mode <- annexFileMode fd <- liftIO $ noUmask mode $ openFd lck ReadWrite (Just mode) defaultFileFlags + setFdOption fd CloseOnExec True v <- liftIO $ tryIO $ setLock fd (WriteLock, AbsoluteSeek, 0, 0) case v of |