summaryrefslogtreecommitdiff
path: root/internal/fusefrontend/xattr_darwin.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-11-11 18:27:37 +0100
committerJakob Unterwurzacher2019-01-01 16:24:25 +0100
commitc3adf9729de82bba52405e9f20f235b6a009308f (patch)
tree5f59613d8d1d729144d9d7e30b72cc61ce1df4ae /internal/fusefrontend/xattr_darwin.go
parentd3ae87fa2b10269f9619f7a36fd4a01f35448fb6 (diff)
fusefrontend: make ListXAttr symlink-safe on Linux
Uses /proc/self/fd.
Diffstat (limited to 'internal/fusefrontend/xattr_darwin.go')
-rw-r--r--internal/fusefrontend/xattr_darwin.go14
1 files changed, 14 insertions, 0 deletions
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
+}