From b44e74ace2d74954c503930b9edb75d0aa9d7b52 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 20 Aug 2014 11:25:07 -0400 Subject: 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. --- Annex/Ssh.hs | 1 + 1 file changed, 1 insertion(+) (limited to 'Annex/Ssh.hs') diff --git a/Annex/Ssh.hs b/Annex/Ssh.hs index 246ac338d..238af0588 100644 --- a/Annex/Ssh.hs +++ b/Annex/Ssh.hs @@ -153,6 +153,7 @@ sshCleanup = mapM_ cleanup =<< enumSocketFiles mode <- annexFileMode fd <- liftIO $ noUmask mode $ openFd lockfile ReadWrite (Just mode) defaultFileFlags + setFdOption fd CloseOnExec True v <- liftIO $ tryIO $ setLock fd (WriteLock, AbsoluteSeek, 0, 0) case v of -- cgit v1.2.3