unix: check Faccessat2 returning EPERM in Faccessat
Some systems (e.g. the linux-arm and linux-arm64-packet builders) return
EPERM instead of ENOSYS on unimplemented syscalls. Fall back to the
existing glibc-like implementation in Faccessat in this case as well.
This fixes tests on the linux-arm and linux-arm64-packet builders after
CL 246537.
Change-Id: I7d7598f9694a2db19bd17e79f333d5de3a31c6e2
Reviewed-on: https://go-review.googlesource.com/c/sys/+/246817
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/unix/syscall_linux.go b/unix/syscall_linux.go
index ab16736..027bcaf 100644
--- a/unix/syscall_linux.go
+++ b/unix/syscall_linux.go
@@ -1972,7 +1972,7 @@
return faccessat(dirfd, path, mode)
}
- if err := Faccessat2(dirfd, path, mode, flags); err != ENOSYS {
+ if err := Faccessat2(dirfd, path, mode, flags); err != ENOSYS && err != EPERM {
return err
}