aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend/names.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-09-22 20:10:34 +0200
committerJakob Unterwurzacher2018-09-23 12:17:26 +0200
commitc270b21efc1d9ecbe5c913c733204f826e263747 (patch)
treef001342e38ab81eeea1292c7a405d30321624b6d /internal/fusefrontend/names.go
parent22fba4ac3ed09ba07d1defb60436fb7a17095d09 (diff)
fusefrontend: get rid of os.File* wrapping
Directly use int file descriptors for the dirfd and get rid of one level of indirection.
Diffstat (limited to 'internal/fusefrontend/names.go')
-rw-r--r--internal/fusefrontend/names.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/internal/fusefrontend/names.go b/internal/fusefrontend/names.go
index d7fbdce..86c87f0 100644
--- a/internal/fusefrontend/names.go
+++ b/internal/fusefrontend/names.go
@@ -3,7 +3,6 @@ package fusefrontend
// This file forwards file encryption operations to cryptfs
import (
- "os"
"path/filepath"
"github.com/rfjakob/gocryptfs/internal/configfile"
@@ -45,17 +44,17 @@ func (fs *FS) getBackingPath(relPath string) (string, error) {
// "relPath" and returns the dirfd and the encrypted basename.
// The caller should then use Openat(dirfd, cName, ...) and friends.
// openBackingDir is secure against symlink races.
-func (fs *FS) openBackingDir(relPath string) (*os.File, string, error) {
+func (fs *FS) openBackingDir(relPath string) (int, string, error) {
cRelPath, err := fs.encryptPath(relPath)
if err != nil {
- return nil, "", err
+ return -1, "", err
}
// Open parent dir
dirfd, err := syscallcompat.OpenDirNofollow(fs.args.Cipherdir, filepath.Dir(cRelPath))
if err != nil {
- return nil, "", err
+ return -1, "", err
}
- return os.NewFile(uintptr(dirfd), cRelPath), filepath.Base(cRelPath), nil
+ return dirfd, filepath.Base(cRelPath), nil
}
// encryptPath - encrypt relative plaintext path