aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend/node_dir_ops.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-06-26 18:44:52 +0200
committerJakob Unterwurzacher2021-06-26 18:49:54 +0200
commit5306fc345be41371820ea50a3f64efab08f2e74c (patch)
treed17b38de256d04f2e48def501d49602f0675f986 /internal/fusefrontend/node_dir_ops.go
parent1f29542b39654bda417ed436b8640b2f2e4f0d6e (diff)
fusefrontend: convert last callers from openBackingDir to prepareAtSyscall
Diffstat (limited to 'internal/fusefrontend/node_dir_ops.go')
-rw-r--r--internal/fusefrontend/node_dir_ops.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/internal/fusefrontend/node_dir_ops.go b/internal/fusefrontend/node_dir_ops.go
index 0f48876..6d03544 100644
--- a/internal/fusefrontend/node_dir_ops.go
+++ b/internal/fusefrontend/node_dir_ops.go
@@ -4,7 +4,6 @@ import (
"context"
"fmt"
"io"
- "path/filepath"
"runtime"
"syscall"
@@ -239,15 +238,14 @@ func (n *Node) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno) {
// Symlink-safe through Unlinkat() + AT_REMOVEDIR.
func (n *Node) Rmdir(ctx context.Context, name string) (code syscall.Errno) {
rn := n.rootNode()
- p := filepath.Join(n.Path(), name)
- parentDirFd, cName, err := rn.openBackingDir(p)
- if err != nil {
- return fs.ToErrno(err)
+ parentDirFd, cName, errno := n.prepareAtSyscall(name)
+ if errno != 0 {
+ return errno
}
defer syscall.Close(parentDirFd)
if rn.args.PlaintextNames {
// Unlinkat with AT_REMOVEDIR is equivalent to Rmdir
- err = unix.Unlinkat(parentDirFd, cName, unix.AT_REMOVEDIR)
+ err := unix.Unlinkat(parentDirFd, cName, unix.AT_REMOVEDIR)
return fs.ToErrno(err)
}
// Unless we are running as root, we need read, write and execute permissions
@@ -256,7 +254,7 @@ func (n *Node) Rmdir(ctx context.Context, name string) (code syscall.Errno) {
var origMode uint32
if !rn.args.PreserveOwner {
var st unix.Stat_t
- err = syscallcompat.Fstatat(parentDirFd, cName, &st, unix.AT_SYMLINK_NOFOLLOW)
+ err := syscallcompat.Fstatat(parentDirFd, cName, &st, unix.AT_SYMLINK_NOFOLLOW)
if err != nil {
return fs.ToErrno(err)
}