Bugfix: directory special remote could loop forever storing a key when a too small chunksize was configured.

Ensure that each file has something written to it, even if the bytestring
chunk size is greater than the configured chunksize.

This means we may write a bit larger than the configured value, but only
when the configured value is very small; ie, < 8 kb.
This commit is contained in:
Joey Hess 2012-11-19 13:30:58 -04:00
parent 5f977cc725
commit 7b71685a93
2 changed files with 3 additions and 1 deletions

View file

@ -158,7 +158,7 @@ storeSplit' meterupdate chunksize (d:dests) bs c = do
feed _ [] _ = return []
feed sz (l:ls) h = do
let s = fromIntegral $ S.length l
if s <= sz
if s <= sz || sz == chunksize
then do
S.hPut h l
meterupdate $ toInteger s