summaryrefslogtreecommitdiff
path: root/internal/fusefrontend_reverse/rfs.go
diff options
context:
space:
mode:
authorSebastian Lackner2017-12-07 18:44:44 +0100
committerrfjakob2017-12-07 23:36:11 +0100
commit3af51736f3f19659d723f60aa480578fae2cddbc (patch)
treef79c1a34ec9b0bcf1a5625a7939ea7cba2777356 /internal/fusefrontend_reverse/rfs.go
parentad0f1101917ab011128ae07df79deee81a2626c7 (diff)
fusefrontend_reverse: Use openBackingDir in GetAttr
Also fixes 48bd59f38843e5ebd4e4c9f666f1aea1c9990803 - the directory FD should also be closed in case of an error.
Diffstat (limited to 'internal/fusefrontend_reverse/rfs.go')
-rw-r--r--internal/fusefrontend_reverse/rfs.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/internal/fusefrontend_reverse/rfs.go b/internal/fusefrontend_reverse/rfs.go
index 48a9bfe..220ed37 100644
--- a/internal/fusefrontend_reverse/rfs.go
+++ b/internal/fusefrontend_reverse/rfs.go
@@ -146,22 +146,17 @@ func (rfs *ReverseFS) GetAttr(relPath string, context *fuse.Context) (*fuse.Attr
}
return &a, status
}
- // Decrypt path to "plaintext relative path"
- pRelPath, err := rfs.decryptPath(relPath)
+ dirfd, name, err := rfs.openBackingDir(relPath)
if err != nil {
return nil, fuse.ToStatus(err)
}
// Stat the backing file/dir using Fstatat
var st unix.Stat_t
- dirFd, err := syscallcompat.OpenNofollow(rfs.args.Cipherdir, filepath.Dir(pRelPath), syscall.O_RDONLY|syscall.O_DIRECTORY, 0)
- if err != nil {
- return nil, fuse.ToStatus(err)
- }
- err = syscallcompat.Fstatat(dirFd, filepath.Base(pRelPath), &st, unix.AT_SYMLINK_NOFOLLOW)
+ err = syscallcompat.Fstatat(dirfd, name, &st, unix.AT_SYMLINK_NOFOLLOW)
+ syscall.Close(dirfd)
if err != nil {
return nil, fuse.ToStatus(err)
}
- syscall.Close(dirFd)
// Instead of risking an inode number collision, we return an error.
if st.Ino > inoBaseMin {
tlog.Warn.Printf("GetAttr %q: backing file inode number %d crosses reserved space, max=%d. Returning EOVERFLOW.",