From ec0f35bc684558b1f5b3dfd1ebf369331e687a47 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 23 Nov 2021 08:39:12 -0800 Subject: [PATCH] libct/system/xattrs: remove This is not used since commit 5e7b48f7c06df2b (23 Mar 2017). In case there are external users, they should switch to opencontainers/selinux. Signed-off-by: Kir Kolyshkin --- libcontainer/system/xattrs_linux.go | 36 ----------------------------- 1 file changed, 36 deletions(-) delete mode 100644 libcontainer/system/xattrs_linux.go diff --git a/libcontainer/system/xattrs_linux.go b/libcontainer/system/xattrs_linux.go deleted file mode 100644 index 01a54fcf5..000000000 --- a/libcontainer/system/xattrs_linux.go +++ /dev/null @@ -1,36 +0,0 @@ -package system - -import "golang.org/x/sys/unix" - -// Returns a []byte slice if the xattr is set and nil otherwise -// Requires path and its attribute as arguments -func Lgetxattr(path string, attr string) ([]byte, error) { - var sz int - // Start with a 128 length byte array - dest := make([]byte, 128) - sz, errno := unix.Lgetxattr(path, attr, dest) - - //nolint:errorlint // unix errors are bare - switch { - case errno == unix.ENODATA: - return nil, errno - case errno == unix.ENOTSUP: - return nil, errno - case errno == unix.ERANGE: - // 128 byte array might just not be good enough, - // A dummy buffer is used to get the real size - // of the xattrs on disk - sz, errno = unix.Lgetxattr(path, attr, []byte{}) - if errno != nil { - return nil, errno - } - dest = make([]byte, sz) - sz, errno = unix.Lgetxattr(path, attr, dest) - if errno != nil { - return nil, errno - } - case errno != nil: - return nil, errno - } - return dest[:sz], nil -}