1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-25 01:06:39 +00:00

prune: Close backend reader after download

Closes #777
This commit is contained in:
Alexander Neumann 2017-02-05 15:40:30 +01:00
parent b85eae2aea
commit 4ca134a41c

View file

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