aboutsummaryrefslogtreecommitdiff
path: root/internal/syscallcompat/emulate.go
diff options
context:
space:
mode:
authorSebastian Lackner2019-01-14 02:45:21 +0100
committerrfjakob2019-01-14 21:27:28 +0100
commit0345cc08307c01da635ea5546952a584480c9a93 (patch)
treef5f6071c1d303e8eb1506c74f5f318768f5f9430 /internal/syscallcompat/emulate.go
parent229a9da74bc0839e2cd481f701c877708b080ede (diff)
syscallcompat: Drop Fchmodat emulation on macOS.
On macOS the function has a flags argument, so we don't need the /proc/self/fd trick used on Linux.
Diffstat (limited to 'internal/syscallcompat/emulate.go')
-rw-r--r--internal/syscallcompat/emulate.go31
1 files changed, 0 insertions, 31 deletions
diff --git a/internal/syscallcompat/emulate.go b/internal/syscallcompat/emulate.go
index 360c0ac..8a538fb 100644
--- a/internal/syscallcompat/emulate.go
+++ b/internal/syscallcompat/emulate.go
@@ -1,7 +1,6 @@
package syscallcompat
import (
- "os"
"path/filepath"
"sync"
"syscall"
@@ -31,36 +30,6 @@ func emulateMknodat(dirfd int, path string, mode uint32, dev int) error {
return syscall.Mknod(path, mode, dev)
}
-// emulateFchmodat emulates the syscall for platforms that don't have it
-// in the kernel (darwin).
-func emulateFchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
- if !filepath.IsAbs(path) {
- 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)
- }
- // We also don't have Lchmod, so emulate it (poorly).
- if flags&unix.AT_SYMLINK_NOFOLLOW != 0 {
- fi, err := os.Lstat(path)
- if err != nil {
- return err
- }
- if fi.Mode()&os.ModeSymlink != 0 {
- return nil
- }
- }
- return syscall.Chmod(path, mode)
-}
-
// emulateFchownat emulates the syscall for platforms that don't have it
// in the kernel (darwin).
func emulateFchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {