diff options
-rw-r--r-- | src/legacy/euidaccess.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/legacy/euidaccess.c b/src/legacy/euidaccess.c new file mode 100644 index 00000000..f37a4ecf --- /dev/null +++ b/src/legacy/euidaccess.c @@ -0,0 +1,18 @@ +#include <unistd.h> +#include <fcntl.h> +#include <errno.h> +#include "syscall.h" +#include "libc.h" + +int euidaccess(const char *filename, int amode) +{ + int ret = __syscall(SYS_faccessat, AT_FDCWD, filename, amode, AT_EACCESS); + if (ret != -ENOSYS) return __syscall_ret(ret); + + if (getuid() == geteuid() && getgid() == getegid()) + return syscall(SYS_access, filename, amode); + + return __syscall_ret(-ENOSYS); +} + +weak_alias(euidaccess, eaccess); |