diff options
author | 2014-02-03 10:16:05 -0400 | |
---|---|---|
committer | 2014-02-03 10:19:06 -0400 | |
commit | 19fee049f6dfba4d4294e16d6d530bc7d0e78c54 (patch) | |
tree | c7888ba624904092b280223a34a044f0c2bdbd9a /Remote | |
parent | 6295ec998fb65607fb8c1d88035b41fa0cb3b0d6 (diff) |
avoid using openFile when withFile can be used
Potentially fixes some FD leak if an action on an opened file handle fails
for some reason. There have been some hard to reproduce reports of
git-annex leaking FDs, and this may solve them.
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/Bup.hs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Remote/Bup.hs b/Remote/Bup.hs index 370cbc1c0..7395b7428 100644 --- a/Remote/Bup.hs +++ b/Remote/Bup.hs @@ -145,9 +145,8 @@ storeEncrypted r buprepo (cipher, enck) k _p = retrieve :: BupRepo -> Key -> AssociatedFile -> FilePath -> MeterUpdate -> Annex Bool retrieve buprepo k _f d _p = do let params = bupParams "join" buprepo [Param $ bupRef k] - liftIO $ catchBoolIO $ do - tofile <- openFile d WriteMode - pipeBup params Nothing (Just tofile) + liftIO $ catchBoolIO $ withFIle d WriteMode $ + pipeBup params Nothing . Just retrieveCheap :: BupRepo -> Key -> FilePath -> Annex Bool retrieveCheap _ _ _ = return False |