bittorrent: Fix locking problem when using addurl file://

Fixes:
/home/joey/tmp/xxx/.git/annex/misctmp/torrent18347: openFile: resource busy (file is locked)
This commit is contained in:
Joey Hess 2014-12-30 13:07:06 -04:00
parent 000fe26d44
commit 6b3d0cb11a
2 changed files with 3 additions and 1 deletions

View file

@ -200,7 +200,8 @@ downloadTorrentFile u = do
return ok
else do
misctmp <- fromRepo gitAnnexTmpMiscDir
withTmpFileIn misctmp "torrent" $ \f _h -> do
withTmpFileIn misctmp "torrent" $ \f h -> do
liftIO $ hClose h
ok <- Url.withUrlOptions $ Url.download u f
when ok $
liftIO $ renameFile f torrent