diff options
Diffstat (limited to 'internal/fusefrontend/xattr_darwin.go')
-rw-r--r-- | internal/fusefrontend/xattr_darwin.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/internal/fusefrontend/xattr_darwin.go b/internal/fusefrontend/xattr_darwin.go index e605f83..f0b755f 100644 --- a/internal/fusefrontend/xattr_darwin.go +++ b/internal/fusefrontend/xattr_darwin.go @@ -18,7 +18,8 @@ func filterXattrSetFlags(flags int) int { return flags &^ xattr.XATTR_NOSECURITY } -// This function is NOT symlink-safe because Darwin lacks fgetxattr(). +// This function is NOT symlink-safe because Darwin lacks +// both fgetxattr() and /proc/self/fd. func (fs *FS) getXattr(relPath string, cAttr string, context *fuse.Context) ([]byte, fuse.Status) { cPath, err := fs.getBackingPath(relPath) if err != nil { @@ -31,6 +32,8 @@ func (fs *FS) getXattr(relPath string, cAttr string, context *fuse.Context) ([]b return cData, fuse.OK } +// This function is NOT symlink-safe because Darwin lacks +// both fsetxattr() and /proc/self/fd. 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 { @@ -39,3 +42,14 @@ func (fs *FS) setXattr(relPath string, cAttr string, cData []byte, flags int, co err = xattr.LSetWithFlags(cPath, cAttr, cData, flags) return unpackXattrErr(err) } + +// This function is NOT symlink-safe because Darwin lacks +// both fremovexattr() and /proc/self/fd. +func (fs *FS) removeXAttr(relPath string, cAttr string, context *fuse.Context) fuse.Status { + cPath, err := fs.getBackingPath(relPath) + if err != nil { + return fuse.ToStatus(err) + } + err = xattr.LRemove(cPath, cAttr) + return unpackXattrErr(err) +} |