summaryrefslogtreecommitdiff
path: root/internal/fusefrontend/fs_dir.go
diff options
context:
space:
mode:
authorSebastian Lackner2017-11-29 12:23:40 +0100
committerSebastian Lackner2017-11-29 12:41:23 +0100
commit0f44c617d01f3e203933459be5fb64c1904d40b6 (patch)
tree14e266ea6e8218d04c58b6dd622ab68810792550 /internal/fusefrontend/fs_dir.go
parent5d44a31b412e3db07313d3f7e839e2838cff67c0 (diff)
syscallcompat: Introduce unlinkat syscall with flags argument
Diffstat (limited to 'internal/fusefrontend/fs_dir.go')
-rw-r--r--internal/fusefrontend/fs_dir.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/fusefrontend/fs_dir.go b/internal/fusefrontend/fs_dir.go
index 91c899e..ae150b5 100644
--- a/internal/fusefrontend/fs_dir.go
+++ b/internal/fusefrontend/fs_dir.go
@@ -11,6 +11,8 @@ import (
"sync"
"syscall"
+ "golang.org/x/sys/unix"
+
"github.com/hanwen/go-fuse/fuse"
"github.com/rfjakob/gocryptfs/internal/configfile"
@@ -231,9 +233,7 @@ retry:
return fuse.ToStatus(err)
}
// Actual Rmdir
- // TODO Use syscall.Unlinkat with the AT_REMOVEDIR flag once it is available
- // in Go
- err = syscall.Rmdir(cPath)
+ err = syscallcompat.Unlinkat(int(parentDirFd.Fd()), cName, unix.AT_REMOVEDIR)
if err != nil {
// This can happen if another file in the directory was created in the
// meantime, undo the rename
@@ -245,7 +245,7 @@ retry:
return fuse.ToStatus(err)
}
// Delete "gocryptfs.diriv.rmdir.XYZ"
- err = syscallcompat.Unlinkat(int(parentDirFd.Fd()), tmpName)
+ err = syscallcompat.Unlinkat(int(parentDirFd.Fd()), tmpName, 0)
if err != nil {
tlog.Warn.Printf("Rmdir: Could not clean up %s: %v", tmpName, err)
}