fix reversion in recent CoW changes

File handle accidentially left open is both a FD leak and causes the
haskell RTS to reject opening it again with "file is locked".
This commit is contained in:
Joey Hess 2021-04-20 11:41:43 -04:00
parent 3d9d1d1416
commit fee6504388
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 28 additions and 1 deletions

View file

@ -494,7 +494,8 @@ retrieveExportWithContentIdentifierM dir cow loc cid dest mkkey p =
storeExportWithContentIdentifierM :: RawFilePath -> CopyCoWTried -> FilePath -> Key -> ExportLocation -> [ContentIdentifier] -> MeterUpdate -> Annex ContentIdentifier
storeExportWithContentIdentifierM dir cow src k loc overwritablecids p = do
liftIO $ createDirectoryUnder dir (toRawFilePath destdir)
withTmpFileIn destdir template $ \tmpf _tmph -> do
withTmpFileIn destdir template $ \tmpf tmph -> do
liftIO $ hClose tmph
fileCopierUnVerified cow src tmpf k p
let tmpf' = toRawFilePath tmpf
resetAnnexFilePerm tmpf'