Skip to content

Commit

Permalink
fusefrontend: list "." and ".." in dir entries
Browse files Browse the repository at this point in the history
Fixes xfstests generic/401
  • Loading branch information
rfjakob committed May 29, 2021
1 parent 738a9e0 commit 18befda
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/fusefrontend/node_dir_ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,12 @@ func (n *Node) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno) {
defer syscall.Close(parentDirFd)

// Read ciphertext directory
var cipherEntries []fuse.DirEntry
fd, err := syscallcompat.Openat(parentDirFd, cDirName, syscall.O_RDONLY|syscall.O_DIRECTORY|syscall.O_NOFOLLOW, 0)
if err != nil {
return nil, fs.ToErrno(err)
}
defer syscall.Close(fd)
cipherEntries, err = syscallcompat.Getdents(fd)
cipherEntries, specialEntries, err := syscallcompat.GetdentsSpecial(fd)
if err != nil {
return nil, fs.ToErrno(err)
}
Expand All @@ -184,6 +183,8 @@ func (n *Node) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno) {
}
// Decrypted directory entries
var plain []fuse.DirEntry
// Add "." and ".."
plain = append(plain, specialEntries...)
// Filter and decrypt filenames
for i := range cipherEntries {
cName := cipherEntries[i].Name
Expand Down

0 comments on commit 18befda

Please sign in to comment.