Selaa lähdekoodia

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.
Rich Felker 11 vuotta sitten
vanhempi
sitoutus
89384f78ce
1 muutettua tiedostoa jossa 1 lisäystä ja 9 poistoa
  1. 1 9
      src/legacy/euidaccess.c

+ 1 - 9
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);