From 1d8b21cdad7e8d2c1c2aa99d10233563638594c5 Mon Sep 17 00:00:00 2001 From: Dmitri Goutnik Date: Wed, 6 Mar 2019 09:41:49 -0500 Subject: [PATCH] Fix build on FreeBSD with Go 1.12 --- internal/restic/node.go | 4 ++-- internal/restic/node_darwin.go | 4 ++++ internal/restic/node_freebsd.go | 4 ++++ internal/restic/node_linux.go | 4 ++++ internal/restic/node_netbsd.go | 4 ++++ internal/restic/node_openbsd.go | 4 ++++ internal/restic/node_solaris.go | 4 ++++ internal/restic/node_windows.go | 4 ++++ 8 files changed, 30 insertions(+), 2 deletions(-) diff --git a/internal/restic/node.go b/internal/restic/node.go index 638306eac..fd63de58f 100644 --- a/internal/restic/node.go +++ b/internal/restic/node.go @@ -321,11 +321,11 @@ func (node Node) createSymlinkAt(path string) error { } func (node *Node) createDevAt(path string) error { - return mknod(path, syscall.S_IFBLK|0600, int(node.Device)) + return mknod(path, syscall.S_IFBLK|0600, node.device()) } func (node *Node) createCharDevAt(path string) error { - return mknod(path, syscall.S_IFCHR|0600, int(node.Device)) + return mknod(path, syscall.S_IFCHR|0600, node.device()) } func (node *Node) createFifoAt(path string) error { diff --git a/internal/restic/node_darwin.go b/internal/restic/node_darwin.go index a3f97096d..e8c2d3815 100644 --- a/internal/restic/node_darwin.go +++ b/internal/restic/node_darwin.go @@ -6,6 +6,10 @@ func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespe return nil } +func (node Node) device() int { + return int(node.Device) +} + func (s statUnix) atim() syscall.Timespec { return s.Atimespec } func (s statUnix) mtim() syscall.Timespec { return s.Mtimespec } func (s statUnix) ctim() syscall.Timespec { return s.Ctimespec } diff --git a/internal/restic/node_freebsd.go b/internal/restic/node_freebsd.go index a3f97096d..35c202b9d 100644 --- a/internal/restic/node_freebsd.go +++ b/internal/restic/node_freebsd.go @@ -6,6 +6,10 @@ func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespe return nil } +func (node Node) device() uint64 { + return node.Device +} + func (s statUnix) atim() syscall.Timespec { return s.Atimespec } func (s statUnix) mtim() syscall.Timespec { return s.Mtimespec } func (s statUnix) ctim() syscall.Timespec { return s.Ctimespec } diff --git a/internal/restic/node_linux.go b/internal/restic/node_linux.go index d33944672..97a19db45 100644 --- a/internal/restic/node_linux.go +++ b/internal/restic/node_linux.go @@ -32,6 +32,10 @@ func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespe return nil } +func (node Node) device() int { + return int(node.Device) +} + func (s statUnix) atim() syscall.Timespec { return s.Atim } func (s statUnix) mtim() syscall.Timespec { return s.Mtim } func (s statUnix) ctim() syscall.Timespec { return s.Ctim } diff --git a/internal/restic/node_netbsd.go b/internal/restic/node_netbsd.go index b588a2b68..8c6626d96 100644 --- a/internal/restic/node_netbsd.go +++ b/internal/restic/node_netbsd.go @@ -6,6 +6,10 @@ func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespe return nil } +func (node Node) device() int { + return int(node.Device) +} + func (s statUnix) atim() syscall.Timespec { return s.Atimespec } func (s statUnix) mtim() syscall.Timespec { return s.Mtimespec } func (s statUnix) ctim() syscall.Timespec { return s.Ctimespec } diff --git a/internal/restic/node_openbsd.go b/internal/restic/node_openbsd.go index 8ca4f95b8..2a6548159 100644 --- a/internal/restic/node_openbsd.go +++ b/internal/restic/node_openbsd.go @@ -6,6 +6,10 @@ func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespe return nil } +func (node Node) device() int { + return int(node.Device) +} + func (s statUnix) atim() syscall.Timespec { return s.Atim } func (s statUnix) mtim() syscall.Timespec { return s.Mtim } func (s statUnix) ctim() syscall.Timespec { return s.Ctim } diff --git a/internal/restic/node_solaris.go b/internal/restic/node_solaris.go index 8ca4f95b8..2a6548159 100644 --- a/internal/restic/node_solaris.go +++ b/internal/restic/node_solaris.go @@ -6,6 +6,10 @@ func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespe return nil } +func (node Node) device() int { + return int(node.Device) +} + func (s statUnix) atim() syscall.Timespec { return s.Atim } func (s statUnix) mtim() syscall.Timespec { return s.Mtim } func (s statUnix) ctim() syscall.Timespec { return s.Ctim } diff --git a/internal/restic/node_windows.go b/internal/restic/node_windows.go index c376cdef6..aa0dee4b2 100644 --- a/internal/restic/node_windows.go +++ b/internal/restic/node_windows.go @@ -22,6 +22,10 @@ func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespe return nil } +func (node Node) device() int { + return int(node.Device) +} + // Getxattr retrieves extended attribute data associated with path. func Getxattr(path, name string) ([]byte, error) { return nil, nil