feat: check for xattr support on posix init

This commit is contained in:
Ben McClelland
2024-03-14 08:16:52 -07:00
parent 7584d474b4
commit 8144d90e25

View File

@@ -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
}