diff --git a/src/restic/backend/local/local.go b/src/restic/backend/local/local.go index 98172af89..4af960e51 100644 --- a/src/restic/backend/local/local.go +++ b/src/restic/backend/local/local.go @@ -118,7 +118,7 @@ func (b *Local) Load(h restic.Handle, p []byte, off int64) (n int, err error) { defer func() { e := f.Close() - if err == nil && e != nil { + if err == nil { err = errors.Wrap(e, "Close") } }() diff --git a/src/restic/backend/sftp/sftp.go b/src/restic/backend/sftp/sftp.go index 2809dc676..95555441f 100644 --- a/src/restic/backend/sftp/sftp.go +++ b/src/restic/backend/sftp/sftp.go @@ -345,7 +345,7 @@ func (r *SFTP) Load(h restic.Handle, p []byte, off int64) (n int, err error) { defer func() { e := f.Close() - if err == nil && e != nil { + if err == nil { err = errors.Wrap(e, "Close") } }()