fusefrontend: list "." and ".." in dir entries

Fixes xfstests generic/401
This commit is contained in:
Jakob Unterwurzacher 2021-05-29 16:44:38 +02:00
parent 738a9e006a
commit 18befda0e6
1 changed files with 3 additions and 2 deletions

View File

@ -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)
}
@ -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