summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/readlink.c
diff options
context:
space:
mode:
authorMarkos Chandras <markos.chandras@imgtec.com>2012-10-10 15:50:28 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2013-02-20 13:45:11 +0100
commite07db64b78c3905baf3aaeb582899f78ab306781 (patch)
treed423ebcc160ca702aa83feeeacdf5cee556a7502 /libc/sysdeps/linux/common/readlink.c
parent3a5be53a84ac68255fbcecb73b8fe58a35550c26 (diff)
readlink: Use readlinkat if arch does not have the readlink syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/sysdeps/linux/common/readlink.c')
-rw-r--r--libc/sysdeps/linux/common/readlink.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/common/readlink.c b/libc/sysdeps/linux/common/readlink.c
index ef9e83539..f64aeb947 100644
--- a/libc/sysdeps/linux/common/readlink.c
+++ b/libc/sysdeps/linux/common/readlink.c
@@ -10,5 +10,13 @@
#include <sys/syscall.h>
#include <unistd.h>
+#if defined(__NR_readlinkat) && !defined(__NR_readlink)
+# include <fcntl.h>
+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)