try again at forcing file read while hashing
This commit is contained in:
parent
41fd029c9b
commit
e3a73e5bb7
1 changed files with 7 additions and 2 deletions
|
@ -5,7 +5,7 @@
|
||||||
- Licensed under the GNU GPL version 3 or higher.
|
- Licensed under the GNU GPL version 3 or higher.
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP, BangPatterns #-}
|
||||||
|
|
||||||
module Backend.Hash (
|
module Backend.Hash (
|
||||||
backends,
|
backends,
|
||||||
|
@ -170,7 +170,12 @@ hashFile hash file filesize = go hash
|
||||||
go (SHA3Hash hashsize) = use (sha3Hasher hashsize)
|
go (SHA3Hash hashsize) = use (sha3Hasher hashsize)
|
||||||
go (SkeinHash hashsize) = use (skeinHasher hashsize)
|
go (SkeinHash hashsize) = use (skeinHasher hashsize)
|
||||||
|
|
||||||
use hasher = liftIO $ hasher <$> L.readFile file
|
use hasher = liftIO $ do
|
||||||
|
hdl <- openBinaryFile file ReadMode
|
||||||
|
b <- L.hGetContents hdl
|
||||||
|
let !hsh = hasher b
|
||||||
|
hClose hdl
|
||||||
|
return hsh
|
||||||
|
|
||||||
usehasher hashsize = case shaHasher hashsize filesize of
|
usehasher hashsize = case shaHasher hashsize filesize of
|
||||||
Left sha -> use sha
|
Left sha -> use sha
|
||||||
|
|
Loading…
Reference in a new issue