mirror of
https://github.com/restic/restic.git
synced 2026-09-27 14:30:29 +00:00
backend/b2: correctly close file if too short
This commit is contained in:
@@ -246,6 +246,7 @@ func (be *b2Backend) Save(ctx context.Context, h backend.Handle, rd backend.Rewi
|
|||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
if n != rd.Length() {
|
if n != rd.Length() {
|
||||||
|
_ = w.Close()
|
||||||
return errors.Errorf("wrote %d bytes instead of the expected %d bytes", n, rd.Length())
|
return errors.Errorf("wrote %d bytes instead of the expected %d bytes", n, rd.Length())
|
||||||
}
|
}
|
||||||
return errors.Wrap(w.Close(), "Close")
|
return errors.Wrap(w.Close(), "Close")
|
||||||
|
|||||||
Reference in New Issue
Block a user