collapse euidaccess to a call to faccessat

it turns out Linux is buggy for faccessat, just like fchmodat: the
kernel does not actually take a flags argument. so we're going to have
to emulate it there.
This commit is contained in:
Rich Felker 2013-08-03 02:28:35 -04:00
parent f0ceb5abd9
commit 89384f78ce
1 changed files with 1 additions and 9 deletions

View File

@ -1,18 +1,10 @@
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h>
#include "syscall.h"
#include "libc.h" #include "libc.h"
int euidaccess(const char *filename, int amode) int euidaccess(const char *filename, int amode)
{ {
int ret = __syscall(SYS_faccessat, AT_FDCWD, filename, amode, AT_EACCESS); return 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); weak_alias(euidaccess, eaccess);