try again at forcing file read while hashing

This commit is contained in:
Joey Hess 2016-02-26 14:04:10 -04:00
parent 41fd029c9b
commit e3a73e5bb7
Failed to extract signature

View file

@ -5,7 +5,7 @@
- Licensed under the GNU GPL version 3 or higher.
-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE CPP, BangPatterns #-}
module Backend.Hash (
backends,
@ -170,7 +170,12 @@ 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
hdl <- openBinaryFile file ReadMode
b <- L.hGetContents hdl
let !hsh = hasher b
hClose hdl
return hsh
usehasher hashsize = case shaHasher hashsize filesize of
Left sha -> use sha