From 14a3ed4e9d2a164586b3ce62e585bf763c1cd6e5 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sat, 16 May 2015 13:25:10 +0200 Subject: [PATCH] Move error annotation for symlink timestamp restore --- node.go | 2 +- node_linux.go | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/node.go b/node.go index aa72adf56..c34a0ed52 100644 --- a/node.go +++ b/node.go @@ -171,7 +171,7 @@ func (node Node) RestoreTimestamps(path string) error { if node.Type == "symlink" { if err := node.restoreSymlinkTimestamps(path, utimes); err != nil { - return errors.Annotate(err, "UtimesNano") + return err } return nil diff --git a/node_linux.go b/node_linux.go index 8ce60efbb..1043397a8 100644 --- a/node_linux.go +++ b/node_linux.go @@ -6,6 +6,8 @@ import ( "syscall" "time" "unsafe" + + "github.com/juju/errors" ) func (node *Node) OpenForReading() (*os.File, error) { @@ -32,7 +34,13 @@ func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespe 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