add legacy euidaccess function and eaccess alias for it

this is mainly for ABI compat purposes.
This commit is contained in:
Rich Felker 2013-08-03 02:15:45 -04:00
parent d3a98ff69a
commit a89aaee110
1 changed files with 18 additions and 0 deletions

18
src/legacy/euidaccess.c Normal file
View File

@ -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);