summaryrefslogtreecommitdiff
path: root/internal/syscallcompat/sys_darwin.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2019-01-14 21:54:16 +0100
committerJakob Unterwurzacher2019-01-14 21:54:16 +0100
commita7d59032d3790e117a48be6be1fb3a968266093b (patch)
tree5c0b642f701106e1f27db5fea69c45bdc5e3dac0 /internal/syscallcompat/sys_darwin.go
parenta9d8eb49ef91c31fddc3e4f2f76e9b98e1a52a1d (diff)
syscallcompat: rework Fchmodat to FchmodatNofollow
We never want Fchmodat to follow symlinks, so follow what Qemu does, and call our function FchmodatNofollow.
Diffstat (limited to 'internal/syscallcompat/sys_darwin.go')
-rw-r--r--internal/syscallcompat/sys_darwin.go11
1 files changed, 2 insertions, 9 deletions
diff --git a/internal/syscallcompat/sys_darwin.go b/internal/syscallcompat/sys_darwin.go
index b8b82c8..ebda80f 100644
--- a/internal/syscallcompat/sys_darwin.go
+++ b/internal/syscallcompat/sys_darwin.go
@@ -8,8 +8,6 @@ import (
"golang.org/x/sys/unix"
"github.com/hanwen/go-fuse/fuse"
-
- "github.com/rfjakob/gocryptfs/internal/tlog"
)
const (
@@ -93,13 +91,8 @@ func MknodatUser(dirfd int, path string, mode uint32, dev int, context *fuse.Con
return Mknodat(dirfd, path, mode, dev)
}
-func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
- // Why would we ever want to call this without AT_SYMLINK_NOFOLLOW?
- if flags&unix.AT_SYMLINK_NOFOLLOW == 0 {
- tlog.Warn.Printf("Fchmodat: adding missing AT_SYMLINK_NOFOLLOW flag")
- flags |= unix.AT_SYMLINK_NOFOLLOW
- }
- return unix.Fchmodat(dirfd, path, mode, flags)
+func FchmodatNofollow(dirfd int, path string, mode uint32) (err error) {
+ return unix.Fchmodat(dirfd, path, mode, unix.AT_SYMLINK_NOFOLLOW)
}
func SymlinkatUser(oldpath string, newdirfd int, newpath string, context *fuse.Context) (err error) {