Add more error handling

This commit is contained in:
Alexander Neumann
2021-01-30 19:35:46 +01:00
parent aef3658a5f
commit 0858fbf6aa
23 changed files with 91 additions and 36 deletions
+3 -2
View File
@@ -15,7 +15,6 @@ func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespe
if err != nil {
return errors.Wrap(err, "Open")
}
defer dir.Close()
times := []unix.Timespec{
{Sec: utimes[0].Sec, Nsec: utimes[0].Nsec},
@@ -25,10 +24,12 @@ func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespe
err = unix.UtimesNanoAt(int(dir.Fd()), filepath.Base(path), times, unix.AT_SYMLINK_NOFOLLOW)
if err != nil {
// ignore subsequent errors
_ = dir.Close()
return errors.Wrap(err, "UtimesNanoAt")
}
return nil
return dir.Close()
}
func (node Node) device() int {