2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-22 10:58:55 +00:00

Merge pull request #2623 from alrs/internal-restic-err-before-close

internal/restic: close os.File after checking for error
This commit is contained in:
rawtaz 2020-03-18 22:23:20 +01:00 committed by GitHub
commit 9efbe98879
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,10 +13,10 @@ import (
func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespec) error { func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespec) error {
dir, err := fs.Open(filepath.Dir(path)) dir, err := fs.Open(filepath.Dir(path))
defer dir.Close()
if err != nil { if err != nil {
return errors.Wrap(err, "Open") return errors.Wrap(err, "Open")
} }
defer dir.Close()
times := []unix.Timespec{ times := []unix.Timespec{
{Sec: utimes[0].Sec, Nsec: utimes[0].Nsec}, {Sec: utimes[0].Sec, Nsec: utimes[0].Nsec},