diff options
author | Jakob Unterwurzacher | 2018-09-08 18:06:33 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2018-09-08 18:06:33 +0200 |
commit | 930c37e03d5ff80e7cdc9f0ca2cd35d80a06d5c0 (patch) | |
tree | 7294ff75cc9ebbc78c5d6fe57c20ca7e69d515d5 /internal/fusefrontend_reverse/reverse_longnames.go | |
parent | 9ec9d0c49cfbdc9ceba10d7534b77e527c0a3cdc (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/reverse_longnames.go')
-rw-r--r-- | internal/fusefrontend_reverse/reverse_longnames.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/fusefrontend_reverse/reverse_longnames.go b/internal/fusefrontend_reverse/reverse_longnames.go index f826d1b..a425e64 100644 --- a/internal/fusefrontend_reverse/reverse_longnames.go +++ b/internal/fusefrontend_reverse/reverse_longnames.go @@ -63,9 +63,15 @@ func (rfs *ReverseFS) findLongnameParent(dir string, dirIV []byte, longname stri if hit != "" { return hit, nil } - fd, err := syscallcompat.OpenDirNofollow(rfs.args.Cipherdir, dir) + dirfd, err := syscallcompat.OpenDirNofollow(rfs.args.Cipherdir, filepath.Dir(dir)) if err != nil { - tlog.Warn.Printf("findLongnameParent: opendir failed: %v\n", err) + tlog.Warn.Printf("findLongnameParent: OpenDirNofollow failed: %v\n", err) + return "", err + } + fd, err := syscallcompat.Openat(dirfd, filepath.Base(dir), syscall.O_RDONLY|syscall.O_DIRECTORY|syscall.O_NOFOLLOW, 0) + syscall.Close(dirfd) + if err != nil { + tlog.Warn.Printf("findLongnameParent: Openat failed: %v\n", err) return "", err } dirEntries, err := syscallcompat.Getdents(fd) |