From 8b938b00bca67af6c759367764c0650b803c9a3e Mon Sep 17 00:00:00 2001 From: Phil Estes Date: Wed, 6 Sep 2017 14:38:07 -0400 Subject: [PATCH] Fix FreeBSD compilation Corrects compile on FreeBSD by handling the lack of ENODATA on FreeBSD. Since continuity project has already handled this, using their const is simpler than separating a few extra files in containerd/containerd. Signed-off-by: Phil Estes --- archive/tar_unix.go | 2 +- fs/diff_unix.go | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/archive/tar_unix.go b/archive/tar_unix.go index 2d60f9207..75bc15b6b 100644 --- a/archive/tar_unix.go +++ b/archive/tar_unix.go @@ -123,7 +123,7 @@ func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo) error { func getxattr(path, attr string) ([]byte, error) { b, err := sysx.LGetxattr(path, attr) - if err == unix.ENOTSUP || err == unix.ENODATA { + if err == unix.ENOTSUP || err == sysx.ENODATA { return nil, nil } return b, err diff --git a/fs/diff_unix.go b/fs/diff_unix.go index 0b860e7f9..36a0f3fde 100644 --- a/fs/diff_unix.go +++ b/fs/diff_unix.go @@ -11,7 +11,6 @@ import ( "github.com/containerd/continuity/sysx" "github.com/pkg/errors" - "golang.org/x/sys/unix" ) // whiteouts are files with a special meaning for the layered filesystem. @@ -84,11 +83,11 @@ func compareSysStat(s1, s2 interface{}) (bool, error) { func compareCapabilities(p1, p2 string) (bool, error) { c1, err := sysx.LGetxattr(p1, "security.capability") - if err != nil && err != unix.ENODATA { + if err != nil && err != sysx.ENODATA { return false, errors.Wrapf(err, "failed to get xattr for %s", p1) } c2, err := sysx.LGetxattr(p2, "security.capability") - if err != nil && err != unix.ENODATA { + if err != nil && err != sysx.ENODATA { return false, errors.Wrapf(err, "failed to get xattr for %s", p2) } return bytes.Equal(c1, c2), nil