summaryrefslogtreecommitdiff
path: root/internal/fusefrontend/xattr.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-11-11 18:04:44 +0100
committerJakob Unterwurzacher2019-01-01 16:24:25 +0100
commitd3ae87fa2b10269f9619f7a36fd4a01f35448fb6 (patch)
tree07b00a19ceb7c92d5d73eb462a73c32c6ba787fb /internal/fusefrontend/xattr.go
parent810d2a8b474e0102a8be3f6b00a3855e182dbd43 (diff)
fusefrontend: make RemoveXAttr() symlink-safe
Uses /proc/self/fd on Linux.
Diffstat (limited to 'internal/fusefrontend/xattr.go')
-rw-r--r--internal/fusefrontend/xattr.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/internal/fusefrontend/xattr.go b/internal/fusefrontend/xattr.go
index b511bcf..8e88a62 100644
--- a/internal/fusefrontend/xattr.go
+++ b/internal/fusefrontend/xattr.go
@@ -68,21 +68,18 @@ func (fs *FS) SetXAttr(relPath string, attr string, data []byte, flags int, cont
// RemoveXAttr - FUSE call.
//
-// TODO: Make symlink-safe. Blocker: package xattr does not provide
-// fremovexattr(2).
-func (fs *FS) RemoveXAttr(path string, attr string, context *fuse.Context) fuse.Status {
- if fs.isFiltered(path) {
+// This function is symlink-safe on Linux.
+// Darwin does not have fremovexattr(2) nor /proc/self/fd. How to implement this
+// on Darwin in a symlink-safe way?
+func (fs *FS) RemoveXAttr(relPath string, attr string, context *fuse.Context) fuse.Status {
+ if fs.isFiltered(relPath) {
return fuse.EPERM
}
if disallowedXAttrName(attr) {
return _EOPNOTSUPP
}
- cPath, err := fs.getBackingPath(path)
- if err != nil {
- return fuse.ToStatus(err)
- }
cAttr := fs.encryptXattrName(attr)
- return unpackXattrErr(xattr.LRemove(cPath, cAttr))
+ return fs.removeXAttr(relPath, cAttr, context)
}
// ListXAttr - FUSE call. Lists extended attributes on the file at "path".