mirror of
https://github.com/restic/restic.git
synced 2024-12-23 00:07:25 +00:00
Move error annotation for symlink timestamp restore
This commit is contained in:
parent
44219c5afe
commit
14a3ed4e9d
2 changed files with 10 additions and 2 deletions
2
node.go
2
node.go
|
@ -171,7 +171,7 @@ func (node Node) RestoreTimestamps(path string) error {
|
||||||
|
|
||||||
if node.Type == "symlink" {
|
if node.Type == "symlink" {
|
||||||
if err := node.restoreSymlinkTimestamps(path, utimes); err != nil {
|
if err := node.restoreSymlinkTimestamps(path, utimes); err != nil {
|
||||||
return errors.Annotate(err, "UtimesNano")
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -6,6 +6,8 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"github.com/juju/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (node *Node) OpenForReading() (*os.File, error) {
|
func (node *Node) OpenForReading() (*os.File, error) {
|
||||||
|
@ -32,7 +34,13 @@ func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespe
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return utimesNanoAt(int(dir.Fd()), filepath.Base(path), utimes, AT_SYMLINK_NOFOLLOW)
|
err = utimesNanoAt(int(dir.Fd()), filepath.Base(path), utimes, AT_SYMLINK_NOFOLLOW)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return errors.Annotate(err, "UtimesNanoAt")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// very lowlevel below
|
// very lowlevel below
|
||||||
|
|
Loading…
Reference in a new issue