From: Markos Chandras <[email protected]>

Signed-off-by: Markos Chandras <[email protected]>
---
 include/unistd.h                       | 1 +
 libc/sysdeps/linux/common/readlink.c   | 8 ++++++++
 libc/sysdeps/linux/common/readlinkat.c | 1 +
 3 files changed, 10 insertions(+)

diff --git a/include/unistd.h b/include/unistd.h
index 296ae0a..bd75bbf 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -850,6 +850,7 @@ extern int symlinkat (__const char *__from, int __tofd,
 extern ssize_t readlinkat (int __fd, __const char *__restrict __path,
                           char *__restrict __buf, size_t __len)
      __THROW __nonnull ((2, 3)) __wur;
+libc_hidden_proto(readlinkat)
 #endif
 
 /* Remove the link NAME.  */
diff --git a/libc/sysdeps/linux/common/readlink.c 
b/libc/sysdeps/linux/common/readlink.c
index ef9e835..5dfd82c 100644
--- a/libc/sysdeps/linux/common/readlink.c
+++ b/libc/sysdeps/linux/common/readlink.c
@@ -8,7 +8,15 @@
  */
 
 #include <sys/syscall.h>
+#include <fcntl.h>
 #include <unistd.h>
 
+#if defined(__NR_readlinkat) && !defined(__NR_readlink)
+ssize_t readlink (const char *path, char *buf, size_t len)
+{
+       return readlinkat(AT_FDCWD, path, buf, len);
+}
+#else
 _syscall3(ssize_t, readlink, const char *, path, char *, buf, size_t, bufsiz)
+#endif
 libc_hidden_def(readlink)
diff --git a/libc/sysdeps/linux/common/readlinkat.c 
b/libc/sysdeps/linux/common/readlinkat.c
index d0a98e1..995b9e2 100644
--- a/libc/sysdeps/linux/common/readlinkat.c
+++ b/libc/sysdeps/linux/common/readlinkat.c
@@ -11,6 +11,7 @@
 
 #ifdef __NR_readlinkat
 _syscall4(ssize_t, readlinkat, int, fd, const char *, path, char *, buf, 
size_t, len)
+libc_hidden_def(readlinkat)
 #else
 /* should add emulation with readlink() and /proc/self/fd/ ... */
 #endif
-- 
1.8.0


_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to