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