Merge pull request #778 from restic/fix-777

prune: Close backend reader after download
This commit is contained in:
Alexander Neumann 2017-02-05 20:01:44 +01:00
commit ec45cdba84

View file

@ -35,14 +35,16 @@ func Repack(repo restic.Repository, packs restic.IDSet, keepBlobs restic.BlobSet
return err
}
defer beRd.Close()
hrd := hashing.NewReader(beRd, sha256.New())
packLength, err := io.Copy(tempfile, hrd)
if err != nil {
return errors.Wrap(err, "Copy")
}
if err = beRd.Close(); err != nil {
return errors.Wrap(err, "Close")
}
hash := restic.IDFromHash(hrd.Sum(nil))
debug.Log("pack %v loaded (%d bytes), hash %v", packID.Str(), packLength, hash.Str())