summaryrefslogtreecommitdiff
path: root/internal/syscallcompat/sys_darwin.go
diff options
context:
space:
mode:
authorSebastian Lackner2017-11-29 12:54:34 +0100
committerSebastian Lackner2017-11-29 12:55:41 +0100
commit0162392a28b75ccb6c3b26c26f2a83b5973a2d92 (patch)
treefe34b074fc11a2a9d73e88cc324e7cfd35b60b6c /internal/syscallcompat/sys_darwin.go
parent0f44c617d01f3e203933459be5fb64c1904d40b6 (diff)
fusefrontend: Use Fchmodat to implement Chmod
Diffstat (limited to 'internal/syscallcompat/sys_darwin.go')
-rw-r--r--internal/syscallcompat/sys_darwin.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/syscallcompat/sys_darwin.go b/internal/syscallcompat/sys_darwin.go
index 527598b..367f67d 100644
--- a/internal/syscallcompat/sys_darwin.go
+++ b/internal/syscallcompat/sys_darwin.go
@@ -137,6 +137,23 @@ func Dup3(oldfd int, newfd int, flags int) (err error) {
return syscall.Dup2(oldfd, newfd)
}
+// Poor man's Fchmodat.
+func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
+ chdirMutex.Lock()
+ defer chdirMutex.Unlock()
+ cwd, err := syscall.Open(".", syscall.O_RDONLY, 0)
+ if err != nil {
+ return err
+ }
+ defer syscall.Close(cwd)
+ err = syscall.Fchdir(dirfd)
+ if err != nil {
+ return err
+ }
+ defer syscall.Fchdir(cwd)
+ return syscall.Chmod(path, mode)
+}
+
// Poor man's Fchownat.
func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
chdirMutex.Lock()