summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-08-03 02:28:35 -0400
committerRich Felker <dalias@aerifal.cx>2013-08-03 02:28:35 -0400
commit89384f78ce79efba22ab3a77e50c3f2a95233f8c (patch)
treef837b1c43df580be63d9376263d4a11805cc3221
parentf0ceb5abd972767209a9b3069e56c5f94b00602a (diff)
downloadmusl-89384f78ce79efba22ab3a77e50c3f2a95233f8c.tar.gz
musl-89384f78ce79efba22ab3a77e50c3f2a95233f8c.tar.bz2
musl-89384f78ce79efba22ab3a77e50c3f2a95233f8c.tar.xz
musl-89384f78ce79efba22ab3a77e50c3f2a95233f8c.zip
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.
-rw-r--r--src/legacy/euidaccess.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/legacy/euidaccess.c b/src/legacy/euidaccess.c
index f37a4ecf..47b464d3 100644
--- a/src/legacy/euidaccess.c
+++ b/src/legacy/euidaccess.c
@@ -1,18 +1,10 @@
#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);
+ return faccessat(AT_FDCWD, filename, amode, AT_EACCESS);
}
weak_alias(euidaccess, eaccess);