From 8144d90e2504f5acc69ed99a058cbe80ec5de5af Mon Sep 17 00:00:00 2001 From: Ben McClelland Date: Thu, 14 Mar 2024 08:16:52 -0700 Subject: [PATCH] feat: check for xattr support on posix init --- backend/posix/posix.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/posix/posix.go b/backend/posix/posix.go index a3f53a9..986dbab 100644 --- a/backend/posix/posix.go +++ b/backend/posix/posix.go @@ -74,6 +74,12 @@ func New(rootdir string) (*Posix, error) { return nil, fmt.Errorf("open %v: %w", rootdir, err) } + _, err = xattr.FGet(f, "user.test") + if errors.Is(err, syscall.ENOTSUP) { + f.Close() + return nil, fmt.Errorf("xattr not supported on %v", rootdir) + } + return &Posix{rootfd: f, rootdir: rootdir}, nil }