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

View File

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