summaryrefslogtreecommitdiff
path: root/internal/fusefrontend_reverse/rfs.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-09-08 18:06:33 +0200
committerJakob Unterwurzacher2018-09-08 18:06:33 +0200
commit930c37e03d5ff80e7cdc9f0ca2cd35d80a06d5c0 (patch)
tree7294ff75cc9ebbc78c5d6fe57c20ca7e69d515d5 /internal/fusefrontend_reverse/rfs.go
parent9ec9d0c49cfbdc9ceba10d7534b77e527c0a3cdc (diff)
syscallcompat: use O_PATH in OpenDirNofollow
This fixes the "0100 directory" problem in reverse mode, and should be slightly faster.
Diffstat (limited to 'internal/fusefrontend_reverse/rfs.go')
-rw-r--r--internal/fusefrontend_reverse/rfs.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/fusefrontend_reverse/rfs.go b/internal/fusefrontend_reverse/rfs.go
index 4f94f3c..9ef6a94 100644
--- a/internal/fusefrontend_reverse/rfs.go
+++ b/internal/fusefrontend_reverse/rfs.go
@@ -305,7 +305,12 @@ func (rfs *ReverseFS) OpenDir(cipherPath string, context *fuse.Context) ([]fuse.
return nil, fuse.ToStatus(err)
}
// Read plaintext dir
- fd, err := syscallcompat.OpenDirNofollow(rfs.args.Cipherdir, relPath)
+ dirfd, err := syscallcompat.OpenDirNofollow(rfs.args.Cipherdir, filepath.Dir(relPath))
+ if err != nil {
+ return nil, fuse.ToStatus(err)
+ }
+ fd, err := syscallcompat.Openat(dirfd, filepath.Base(relPath), syscall.O_RDONLY|syscall.O_DIRECTORY|syscall.O_NOFOLLOW, 0)
+ syscall.Close(dirfd)
if err != nil {
return nil, fuse.ToStatus(err)
}