Browse Source

add support for euidaccess/eaccess legacy functions

Implementation taken from musl libc project.
Missing functions recognized by buildroot autobuilders
with failing open-vm-tools.
Waldemar Brodkorb 8 years ago
parent
commit
8c142592ef
3 changed files with 12 additions and 1 deletions
  1. 1 1
      include/unistd.h
  2. 1 0
      libc/sysdeps/linux/common/Makefile.in
  3. 10 0
      libc/sysdeps/linux/common/euidaccess.c

+ 1 - 1
include/unistd.h

@@ -290,7 +290,7 @@ typedef __socklen_t socklen_t;
 /* Test for access to NAME using the real UID and real GID.  */
 extern int access (const char *__name, int __type) __THROW __nonnull ((1));
 
-#if 0 /*def __USE_GNU*/
+#if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
 /* Test for access to NAME using the effective UID and GID
    (as normal file operations use).  */
 extern int euidaccess (const char *__name, int __type)

+ 1 - 0
libc/sysdeps/linux/common/Makefile.in

@@ -24,6 +24,7 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += \
 	capget.c \
 	capset.c \
 	dup3.c \
+	euidaccess.c \
 	eventfd.c \
 	eventfd_read.c \
 	eventfd_write.c \

+ 10 - 0
libc/sysdeps/linux/common/euidaccess.c

@@ -0,0 +1,10 @@
+#define _GNU_SOURCE
+#include <unistd.h>
+#include <fcntl.h>
+
+int euidaccess(const char *filename, int amode)
+{
+	return faccessat(AT_FDCWD, filename, amode, AT_EACCESS);
+}
+
+weak_alias(euidaccess, eaccess);