Add more error handling

This commit is contained in:
Alexander Neumann
2021-01-30 20:19:47 +01:00
parent aef3658a5f
commit 0858fbf6aa
23 changed files with 91 additions and 36 deletions
+3 -1
View File
@@ -38,7 +38,9 @@ func (l Lock) processExists() bool {
debug.Log("error searching for process %d: %v\n", l.PID, err)
return false
}
defer proc.Release()
defer func() {
_ = proc.Release()
}()
debug.Log("sending SIGHUP to process %d\n", l.PID)
err = proc.Signal(syscall.SIGHUP)
+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 {
+2 -1
View File
@@ -29,7 +29,8 @@ func BenchmarkNodeFillUser(t *testing.B) {
t.ResetTimer()
for i := 0; i < t.N; i++ {
restic.NodeFromFileInfo(path, fi)
_, err := restic.NodeFromFileInfo(path, fi)
rtest.OK(t, err)
}
rtest.OK(t, tempfile.Close())