From c3adf9729de82bba52405e9f20f235b6a009308f Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 11 Nov 2018 18:27:37 +0100 Subject: fusefrontend: make ListXAttr symlink-safe on Linux Uses /proc/self/fd. --- internal/fusefrontend/xattr_darwin.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'internal/fusefrontend/xattr_darwin.go') diff --git a/internal/fusefrontend/xattr_darwin.go b/internal/fusefrontend/xattr_darwin.go index f0b755f..ad81320 100644 --- a/internal/fusefrontend/xattr_darwin.go +++ b/internal/fusefrontend/xattr_darwin.go @@ -53,3 +53,17 @@ func (fs *FS) removeXAttr(relPath string, cAttr string, context *fuse.Context) f err = xattr.LRemove(cPath, cAttr) return unpackXattrErr(err) } + +// This function is NOT symlink-safe because Darwin lacks +// both flistxattr() and /proc/self/fd. +func (fs *FS) listXAttr(relPath string, context *fuse.Context) ([]string, fuse.Status) { + cPath, err := fs.getBackingPath(relPath) + if err != nil { + return nil, fuse.ToStatus(err) + } + cNames, err := xattr.LList(cPath) + if err != nil { + return nil, unpackXattrErr(err) + } + return cNames, fuse.OK +} -- cgit v1.2.3