summaryrefslogtreecommitdiff
path: root/internal/fusefrontend/xattr_darwin.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-11-11 17:57:24 +0100
committerJakob Unterwurzacher2019-01-01 16:24:25 +0100
commit810d2a8b474e0102a8be3f6b00a3855e182dbd43 (patch)
tree67fd54b970e45c6f02ce1ec1f318c69c8859175b /internal/fusefrontend/xattr_darwin.go
parent2286372603f506cf719654a9901de0749c544b12 (diff)
fusefrontend: make SetXAttr() symlink-safe on Linux
Uses the /proc/self/fd trick.
Diffstat (limited to 'internal/fusefrontend/xattr_darwin.go')
-rw-r--r--internal/fusefrontend/xattr_darwin.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/fusefrontend/xattr_darwin.go b/internal/fusefrontend/xattr_darwin.go
index cf48d13..e605f83 100644
--- a/internal/fusefrontend/xattr_darwin.go
+++ b/internal/fusefrontend/xattr_darwin.go
@@ -30,3 +30,12 @@ func (fs *FS) getXattr(relPath string, cAttr string, context *fuse.Context) ([]b
}
return cData, fuse.OK
}
+
+func (fs *FS) setXattr(relPath string, cAttr string, cData []byte, flags int, context *fuse.Context) fuse.Status {
+ cPath, err := fs.getBackingPath(relPath)
+ if err != nil {
+ return fuse.ToStatus(err)
+ }
+ err = xattr.LSetWithFlags(cPath, cAttr, cData, flags)
+ return unpackXattrErr(err)
+}