From db26917bb5574e99ed3c11aa4087018a9eb03930 Mon Sep 17 00:00:00 2001 From: klauspost Date: Wed, 12 Aug 2015 16:14:56 +0200 Subject: [PATCH] EWINDOWS is not present on other OS'es, so use a stub function instead. --- node.go | 4 ++-- node_unix.go | 2 ++ node_windows.go | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/node.go b/node.go index e79c1c387..7a2b315a4 100644 --- a/node.go +++ b/node.go @@ -148,8 +148,8 @@ func (node *Node) CreateAt(path string, repo *repository.Repository) error { func (node Node) restoreMetadata(path string) error { var err error - err = os.Lchown(path, int(node.UID), int(node.GID)) - if err != nil && err != syscall.EWINDOWS { + err = lchown(path, int(node.UID), int(node.GID)) + if err != nil { return errors.Annotate(err, "Lchown") } diff --git a/node_unix.go b/node_unix.go index 521865da0..5c0c4d63c 100644 --- a/node_unix.go +++ b/node_unix.go @@ -5,10 +5,12 @@ package restic import ( + "os" "syscall" ) var mknod = syscall.Mknod +var lchown = os.Lchown type statUnix syscall.Stat_t diff --git a/node_windows.go b/node_windows.go index c9cf9e854..7d5854b80 100644 --- a/node_windows.go +++ b/node_windows.go @@ -20,6 +20,11 @@ var mknod = func(path string, mode uint32, dev int) (err error) { panic("mknod not implemented") } +// Windows doesn't need lchown +var lchown = func(path string, uid int, gid int) (err error) { + return nil +} + func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespec) error { return nil }