mirror of
https://github.com/restic/restic.git
synced 2026-06-21 16:14:18 +00:00
backend/sftp: fix file handle leak if chmod for a file fails
This commit is contained in:
@@ -363,6 +363,7 @@ func (r *SFTP) Save(_ context.Context, h backend.Handle, rd backend.RewindReader
|
||||
if err == nil {
|
||||
err = f.Chmod(r.Modes.File)
|
||||
if err != nil {
|
||||
_ = f.Close()
|
||||
return errors.Wrapf(err, "Chmod %v", tmpFilename)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user