summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkos Chandras <markos.chandras@imgtec.com>2012-10-11 12:30:56 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2013-02-20 13:45:13 +0100
commit789e2402f34dcc72a17f58be3227d12e9da12a21 (patch)
tree9c4b296a6835fe0c8d9b2f69ea69c14ae24d261d
parent677adae2b0cdb267b9c3fc46e7b4e330778c9edc (diff)
lstat64: Use fstatat64 if arch does not have the lstat64 syscall
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-rw-r--r--libc/sysdeps/linux/common/lstat64.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/libc/sysdeps/linux/common/lstat64.c b/libc/sysdeps/linux/common/lstat64.c
index 85e269819..c43e53e1d 100644
--- a/libc/sysdeps/linux/common/lstat64.c
+++ b/libc/sysdeps/linux/common/lstat64.c
@@ -10,11 +10,21 @@
#include <_lfs_64.h>
#include <sys/syscall.h>
-#ifdef __NR_lstat64
# include <unistd.h>
# include <sys/stat.h>
-# include "xstatconv.h"
+#if defined __NR_fstatat64 && !defined __NR_lstat64
+# include <fcntl.h>
+
+int lstat64(const char *file_name, struct stat64 *buf)
+{
+ return fstatat64(AT_FDCWD, file_name, buf, AT_SYMLINK_NOFOLLOW);
+}
+libc_hidden_def(lstat64)
+
+/* For systems which have both, prefer the old one */
+#elif defined __NR_lstat64
+# include "xstatconv.h"
# define __NR___syscall_lstat64 __NR_lstat64
static __always_inline _syscall2(int, __syscall_lstat64, const char *, file_name,
struct kernel_stat64 *, buf)