force hash to finish with file before returning
Fixes a minor fd leak, never more than 1 in normal use, which broke the test suite when I tried to write to a file that was still open for a previous hashing.
This commit is contained in:
parent
2e071a09b7
commit
7482853ddd
1 changed files with 4 additions and 2 deletions
|
@ -5,7 +5,7 @@
|
|||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE BangPatterns, CPP #-}
|
||||
|
||||
module Backend.Hash (
|
||||
backends,
|
||||
|
@ -171,7 +171,9 @@ hashFile hash file filesize = go hash
|
|||
go (SHA3Hash hashsize) = use (sha3Hasher hashsize)
|
||||
go (SkeinHash hashsize) = use (skeinHasher hashsize)
|
||||
|
||||
use hasher = liftIO $ hasher <$> L.readFile file
|
||||
use hasher = liftIO $ do
|
||||
!h <- hasher <$> L.readFile file
|
||||
return h
|
||||
|
||||
usehasher hashsize = case shaHasher hashsize filesize of
|
||||
Left sha -> use sha
|
||||
|
|
Loading…
Reference in a new issue