mirror of
https://github.com/restic/restic.git
synced 2026-10-06 02:40:31 +00:00
Add more error handling
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user