summaryrefslogtreecommitdiff
path: root/src/legacy/euidaccess.c
blob: f37a4ecf452a3db3705d5016e31a493c236a4c7c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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);