summaryrefslogtreecommitdiff
path: root/Annex/Transfer.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-09-11 13:53:26 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-09-11 13:53:26 -0400
commit0d5123633d8a9da1670b7b348d4c5def133d9d45 (patch)
tree2bb04d0b7f941f954461f1093d7e30f4cdd56d36 /Annex/Transfer.hs
parent23b5fc25df3c466894431ff29d7c393a975a04ab (diff)
Fix transfer lock file FD leak that could occur when two separate git-annex processes were both working to perform the same set of transfers.
Diffstat (limited to 'Annex/Transfer.hs')
-rw-r--r--Annex/Transfer.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Annex/Transfer.hs b/Annex/Transfer.hs
index 448b5b3d7..d33d3073b 100644
--- a/Annex/Transfer.hs
+++ b/Annex/Transfer.hs
@@ -85,7 +85,9 @@ runTransfer' ignorelock t file shouldretry a = do
locked <- catchMaybeIO $
setLock fd (WriteLock, AbsoluteSeek, 0, 0)
if isNothing locked
- then return (Nothing, True)
+ then do
+ closeFd fd
+ return (Nothing, True)
else do
void $ tryIO $ writeTransferInfoFile info tfile
return (mfd, False)