summaryrefslogtreecommitdiff
path: root/internal/fusefrontend/xattr_linux.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_linux.go
parent810d2a8b474e0102a8be3f6b00a3855e182dbd43 (diff)
fusefrontend: make RemoveXAttr() symlink-safe
Uses /proc/self/fd on Linux.
Diffstat (limited to 'internal/fusefrontend/xattr_linux.go')
-rw-r--r--internal/fusefrontend/xattr_linux.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/fusefrontend/xattr_linux.go b/internal/fusefrontend/xattr_linux.go
index 659657d..a17b12c 100644
--- a/internal/fusefrontend/xattr_linux.go
+++ b/internal/fusefrontend/xattr_linux.go
@@ -84,3 +84,18 @@ func (fs *FS) setXattr(relPath string, cAttr string, cData []byte, flags int, co
err := xattr.SetWithFlags(procFd(fd), cAttr, cData, flags)
return unpackXattrErr(err)
}
+
+// removeXAttr - remove encrypted xattr name "cAttr" from
+// plaintext path "relPath".
+//
+// This function is symlink-safe on Linux by using /proc/self/fd.
+func (fs *FS) removeXAttr(relPath string, cAttr string, context *fuse.Context) fuse.Status {
+ file, fd, status := fs.getFileFd(relPath, context)
+ if !status.Ok() {
+ return status
+ }
+ defer file.Release()
+
+ err := xattr.Remove(procFd(fd), cAttr)
+ return unpackXattrErr(err)
+}