diff options
author | Jakob Unterwurzacher | 2019-01-03 15:59:54 +0100 |
---|---|---|
committer | Jakob Unterwurzacher | 2019-01-03 15:59:54 +0100 |
commit | fcdb4bec0910dd4bb49f625621fdfb345efc44ae (patch) | |
tree | f19958aa09c9b61e4fe8cd7c77017c36c18ebc98 /internal/fusefrontend/openbackingdir.go | |
parent | bb9884549bab29e73dd0a7cb98ed7e8422796306 (diff) |
fusefronted: dirCache: fix bug handling ""
Bug looked like this:
$ ls -l .
total 0
drwxrwxr-x. 2 jakob jakob 60 Jan 3 15:42 foo
-rw-rw-r--. 1 jakob jakob 0 Jan 3 15:46 x
$ ls -l .
ls: cannot access '.': No such file or directory
(only happened when "" was in the dirCache)
Diffstat (limited to 'internal/fusefrontend/openbackingdir.go')
-rw-r--r-- | internal/fusefrontend/openbackingdir.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/fusefrontend/openbackingdir.go b/internal/fusefrontend/openbackingdir.go index 4da7fd6..d56848f 100644 --- a/internal/fusefrontend/openbackingdir.go +++ b/internal/fusefrontend/openbackingdir.go @@ -33,6 +33,10 @@ func (fs *FS) openBackingDir(relPath string) (dirfd int, cName string, err error // Cache lookup dirfd, iv := fs.dirCache.Lookup(dirRelPath) if dirfd > 0 { + // If relPath is empty, cName is ".". + if relPath == "" { + return dirfd, ".", nil + } name := filepath.Base(relPath) cName = fs.nameTransform.EncryptAndHashName(name, iv) return dirfd, cName, nil |