about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-08-03 02:15:45 -0400
committerRich Felker <dalias@aerifal.cx>2013-08-03 02:15:45 -0400
commita89aaee110b27f90b7e3b9c3823d6ba7cb9f0d24 (patch)
tree81c1f5bc94d36033b81b7951ab2dc69d2b2380e2
parentd3a98ff69a41d96d0a73f1d5b686f73a03a2f9df (diff)
downloadmusl-a89aaee110b27f90b7e3b9c3823d6ba7cb9f0d24.tar.gz
musl-a89aaee110b27f90b7e3b9c3823d6ba7cb9f0d24.tar.xz
musl-a89aaee110b27f90b7e3b9c3823d6ba7cb9f0d24.zip
add legacy euidaccess function and eaccess alias for it
this is mainly for ABI compat purposes.
-rw-r--r--src/legacy/euidaccess.c18
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);