diff options
author | Jakob Unterwurzacher | 2016-07-03 20:17:40 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2016-07-03 20:17:40 +0200 |
commit | d8524c73696392c7e895e6b3fe4c7e120d7296f7 (patch) | |
tree | fa071f1ffb9946bfdd152c2ab7c5e9496b3ea52e /internal/fusefrontend | |
parent | 1d7728959c2120cd9bc0f1280cbdd1daccaa497c (diff) |
syscallcompat: OSX: add Unlinkat wrapper
Also, replace remaining naked syscall.Openat calls.
Diffstat (limited to 'internal/fusefrontend')
-rw-r--r-- | internal/fusefrontend/fs.go | 4 | ||||
-rw-r--r-- | internal/fusefrontend/fs_dir.go | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/internal/fusefrontend/fs.go b/internal/fusefrontend/fs.go index 561af8f..279c755 100644 --- a/internal/fusefrontend/fs.go +++ b/internal/fusefrontend/fs.go @@ -133,7 +133,7 @@ func (fs *FS) Create(path string, flags uint32, mode uint32, context *fuse.Conte // Create content var fdRaw int - fdRaw, err = syscall.Openat(int(dirfd.Fd()), cName, iflags|os.O_CREATE, mode) + fdRaw, err = syscallcompat.Openat(int(dirfd.Fd()), cName, iflags|os.O_CREATE, mode) if err != nil { nametransform.DeleteLongName(dirfd, cName) return nil, fuse.ToStatus(err) @@ -295,7 +295,7 @@ func (fs *FS) Unlink(path string, context *fuse.Context) (code fuse.Status) { } defer dirfd.Close() // Delete content - err = syscall.Unlinkat(int(dirfd.Fd()), cName) + err = syscallcompat.Unlinkat(int(dirfd.Fd()), cName) if err != nil { return fuse.ToStatus(err) } diff --git a/internal/fusefrontend/fs_dir.go b/internal/fusefrontend/fs_dir.go index 699ec7b..ab97932 100644 --- a/internal/fusefrontend/fs_dir.go +++ b/internal/fusefrontend/fs_dir.go @@ -114,7 +114,7 @@ func (fs *FS) Rmdir(path string, context *fuse.Context) (code fuse.Status) { defer parentDirFd.Close() cName := filepath.Base(cPath) - dirfdRaw, err := syscall.Openat(int(parentDirFd.Fd()), cName, + dirfdRaw, err := syscallcompat.Openat(int(parentDirFd.Fd()), cName, syscall.O_RDONLY, 0) if err == syscall.EACCES { // We need permission to read and modify the directory @@ -136,7 +136,7 @@ func (fs *FS) Rmdir(path string, context *fuse.Context) (code fuse.Status) { // Retry open var st syscall.Stat_t syscall.Lstat(cPath, &st) - dirfdRaw, err = syscall.Openat(int(parentDirFd.Fd()), cName, + dirfdRaw, err = syscallcompat.Openat(int(parentDirFd.Fd()), cName, syscall.O_RDONLY, 0) // Undo the chmod if removing the directory failed defer func() { @@ -191,7 +191,7 @@ func (fs *FS) Rmdir(path string, context *fuse.Context) (code fuse.Status) { return fuse.ToStatus(err) } // Delete "gocryptfs.diriv.rmdir.XYZ" - err = syscall.Unlinkat(int(parentDirFd.Fd()), tmpName) + err = syscallcompat.Unlinkat(int(parentDirFd.Fd()), tmpName) if err != nil { tlog.Warn.Printf("Rmdir: Could not clean up %s: %v", tmpName, err) } |