mirror of
https://github.com/restic/restic.git
synced 2026-11-08 08:03:38 +00:00
backend/b2: correctly close file if too short
This commit is contained in:
1 parent
6b88b072e0
commit
5c8c048c1a
1 file changed
+1
@@ -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