diff options
Diffstat (limited to 'internal/fusefrontend_reverse/node_dir_ops.go')
-rw-r--r-- | internal/fusefrontend_reverse/node_dir_ops.go | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/internal/fusefrontend_reverse/node_dir_ops.go b/internal/fusefrontend_reverse/node_dir_ops.go index c287284..21b9775 100644 --- a/internal/fusefrontend_reverse/node_dir_ops.go +++ b/internal/fusefrontend_reverse/node_dir_ops.go @@ -23,6 +23,22 @@ import ( // This function is symlink-safe through use of openBackingDir() and // ReadDirIVAt(). func (n *Node) Readdir(ctx context.Context) (stream fs.DirStream, errno syscall.Errno) { + // Virtual files: at least one gocryptfs.diriv file + virtualFiles := []fuse.DirEntry{ + {Mode: virtualFileMode, Name: nametransform.DirIVFilename}, + } + rn := n.rootNode() + + // This directory is a mountpoint. Present it as empty. + if rn.args.OneFileSystem && n.isOtherFilesystem { + if rn.args.PlaintextNames { + return fs.NewListDirStream(nil), 0 + } else { + // An "empty" directory still has a gocryptfs.diriv file! + return fs.NewListDirStream(virtualFiles), 0 + } + } + d, errno := n.prepareAtSyscall("") if errno != 0 { return @@ -41,8 +57,6 @@ func (n *Node) Readdir(ctx context.Context) (stream fs.DirStream, errno syscall. return nil, fs.ToErrno(err) } - rn := n.rootNode() - // Filter out excluded entries entries = rn.excludeDirEntries(d, entries) @@ -50,11 +64,6 @@ func (n *Node) Readdir(ctx context.Context) (stream fs.DirStream, errno syscall. return n.readdirPlaintextnames(entries) } - // Virtual files: at least one gocryptfs.diriv file - virtualFiles := []fuse.DirEntry{ - {Mode: virtualFileMode, Name: nametransform.DirIVFilename}, - } - dirIV := pathiv.Derive(d.cPath, pathiv.PurposeDirIV) // Encrypt names for i := range entries { |