| 1 |
// Copyright 2024 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
//go:build unix |
| 6 |
|
| 7 |
package unix |
| 8 |
|
| 9 |
import ( |
| 10 |
"runtime" |
| 11 |
"syscall" |
| 12 |
) |
| 13 |
|
| 14 |
func Eaccess(path string, mode uint32) error { |
| 15 |
if runtime.GOOS == "android" { |
| 16 |
// syscall.Faccessat for Android implements AT_EACCESS check in |
| 17 |
// userspace. Since Android doesn't have setuid programs and |
| 18 |
// never runs code with euid!=uid, AT_EACCESS check is not |
| 19 |
// really required. Return ENOSYS so the callers can fall back |
| 20 |
// to permission bits check. |
| 21 |
return syscall.ENOSYS |
| 22 |
} |
| 23 |
return faccessat(AT_FDCWD, path, mode, AT_EACCESS) |
| 24 |
} |