aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend/xattr.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2019-01-04 22:22:24 +0100
committerJakob Unterwurzacher2019-01-04 22:22:24 +0100
commiteff35e60b63331e3e10f921792baa10b236a721d (patch)
tree694d89142c0a5293ee50ae304d913ef04890f08d /internal/fusefrontend/xattr.go
parent3365cfc02bf0ac9de82ce20bf597af4a2a82cd7d (diff)
fusefrontend: fix setting xattrs on directories
Directories cannot be opened read-write. Retry with RDONLY.
Diffstat (limited to 'internal/fusefrontend/xattr.go')
-rw-r--r--internal/fusefrontend/xattr.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/fusefrontend/xattr.go b/internal/fusefrontend/xattr.go
index ad1c330..2248bad 100644
--- a/internal/fusefrontend/xattr.go
+++ b/internal/fusefrontend/xattr.go
@@ -71,6 +71,10 @@ func (fs *FS) SetXAttr(relPath string, attr string, data []byte, flags int, cont
// O_NONBLOCK to not block on FIFOs.
fd, err := fs.openBackingFile(relPath, syscall.O_WRONLY|syscall.O_NONBLOCK)
+ // Directories cannot be opened read-write. Retry.
+ if err == syscall.EISDIR {
+ fd, err = fs.openBackingFile(relPath, syscall.O_RDONLY|syscall.O_DIRECTORY|syscall.O_NONBLOCK)
+ }
if err != nil {
return fuse.ToStatus(err)
}
@@ -100,6 +104,10 @@ func (fs *FS) RemoveXAttr(relPath string, attr string, context *fuse.Context) fu
// O_NONBLOCK to not block on FIFOs.
fd, err := fs.openBackingFile(relPath, syscall.O_WRONLY|syscall.O_NONBLOCK)
+ // Directories cannot be opened read-write. Retry.
+ if err == syscall.EISDIR {
+ fd, err = fs.openBackingFile(relPath, syscall.O_RDONLY|syscall.O_DIRECTORY|syscall.O_NONBLOCK)
+ }
if err != nil {
return fuse.ToStatus(err)
}