diff options
author | Rich Felker <dalias@aerifal.cx> | 2013-08-03 02:15:45 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2013-08-03 02:15:45 -0400 |
commit | a89aaee110b27f90b7e3b9c3823d6ba7cb9f0d24 (patch) | |
tree | 81c1f5bc94d36033b81b7951ab2dc69d2b2380e2 /src | |
parent | d3a98ff69a41d96d0a73f1d5b686f73a03a2f9df (diff) | |
download | musl-a89aaee110b27f90b7e3b9c3823d6ba7cb9f0d24.tar.gz |
add legacy euidaccess function and eaccess alias for it
this is mainly for ABI compat purposes.
Diffstat (limited to 'src')
-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); |