From: Rich Felker Date: Sat, 3 Aug 2013 06:15:45 +0000 (-0400) Subject: add legacy euidaccess function and eaccess alias for it X-Git-Tag: v0.9.13~89 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a89aaee110b27f90b7e3b9c3823d6ba7cb9f0d24;p=oweals%2Fmusl.git add legacy euidaccess function and eaccess alias for it this is mainly for ABI compat purposes. --- 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 +#include +#include +#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);