From 0805a63df1b5f915b228727f6074c2506922d0ad Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 20 Jan 2019 12:59:59 +0100 Subject: syscallcompat: drop Faccessat AT_SYMLINK_NOFOLLOW helper unix.Faccessat has added support for AT_SYMLINK_NOFOLLOW in July 2018, https://github.com/golang/sys/commit/bd9dbc187b6e1dacfdd2722a87e83093c2d7bd6e#diff-341484dbbe3180cd7a31ef2ad2d679b6 which means we no longer need our own helper. Closes https://github.com/rfjakob/gocryptfs/issues/347 --- internal/syscallcompat/sys_common.go | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'internal/syscallcompat/sys_common.go') diff --git a/internal/syscallcompat/sys_common.go b/internal/syscallcompat/sys_common.go index b6bbdff..aedc4da 100644 --- a/internal/syscallcompat/sys_common.go +++ b/internal/syscallcompat/sys_common.go @@ -29,21 +29,6 @@ func Readlinkat(dirfd int, path string) (string, error) { } } -// Faccessat exists both in Linux and in MacOS 10.10+, but the Linux version -// DOES NOT support any flags. Emulate AT_SYMLINK_NOFOLLOW like glibc does. -func Faccessat(dirfd int, path string, mode uint32) error { - var st unix.Stat_t - err := Fstatat(dirfd, path, &st, unix.AT_SYMLINK_NOFOLLOW) - if err != nil { - return err - } - if st.Mode&syscall.S_IFMT == syscall.S_IFLNK { - // Pretend that a symlink is always accessible - return nil - } - return unix.Faccessat(dirfd, path, mode, 0) -} - // Openat wraps the Openat syscall. func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) { if flags&syscall.O_CREAT != 0 { -- cgit v1.2.3