1
0
mirror of https://github.com/restic/restic.git synced 2024-06-26 07:49:01 +02:00

internal/restic: close os.File after checking for error

This commit is contained in:
Lars Lehtonen 2020-03-05 16:22:46 -08:00
parent a307797c11
commit 4a2156d3f0
No known key found for this signature in database
GPG Key ID: 8137D474EBCB04F2

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},