fusefrontend_reverse: Use openBackingDir in Readlink

This commit is contained in:
Sebastian Lackner 2017-12-07 18:36:52 +01:00 committed by rfjakob
parent 48bd59f388
commit ad0f110191

View File

@ -327,18 +327,13 @@ func (rfs *ReverseFS) StatFs(path string) *fuse.StatfsOut {
// Readlink - FUSE call // Readlink - FUSE call
func (rfs *ReverseFS) Readlink(relPath string, context *fuse.Context) (string, fuse.Status) { func (rfs *ReverseFS) Readlink(relPath string, context *fuse.Context) (string, fuse.Status) {
// Decrypt path to "plaintext relative path" dirfd, name, err := rfs.openBackingDir(relPath)
pRelPath, err := rfs.decryptPath(relPath)
if err != nil { if err != nil {
return "", fuse.ToStatus(err) return "", fuse.ToStatus(err)
} }
// read the link target using Readlinkat // read the link target using Readlinkat
dirFd, err := syscallcompat.OpenNofollow(rfs.args.Cipherdir, filepath.Dir(pRelPath), syscall.O_RDONLY|syscall.O_DIRECTORY, 0) plainTarget, err := syscallcompat.Readlinkat(dirfd, name)
if err != nil { syscall.Close(dirfd)
return "", fuse.ToStatus(err)
}
plainTarget, err := syscallcompat.Readlinkat(dirFd, filepath.Base(pRelPath))
syscall.Close(dirFd)
if err != nil { if err != nil {
return "", fuse.ToStatus(err) return "", fuse.ToStatus(err)
} }