fix: close backup file (#419)

This commit is contained in:
guangwu
2024-05-16 15:35:28 +08:00
committed by GitHub
parent 9b5ba8958d
commit 4cb47a4818

View File

@@ -51,6 +51,7 @@ func (s *script) encryptArchive() error {
if err != nil { if err != nil {
return errwrap.Wrap(err, fmt.Sprintf("error opening backup file `%s`", s.file)) return errwrap.Wrap(err, fmt.Sprintf("error opening backup file `%s`", s.file))
} }
defer src.Close()
if _, err := io.Copy(dst, src); err != nil { if _, err := io.Copy(dst, src); err != nil {
return errwrap.Wrap(err, "error writing ciphertext to file") return errwrap.Wrap(err, "error writing ciphertext to file")