[git commit] lstat64: Use fstatat64 if arch does not have the lstat64 syscall

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Wed Feb 20 12:45:13 UTC 2013


commit: http://git.uclibc.org/uClibc/commit/?id=789e2402f34dcc72a17f58be3227d12e9da12a21
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

Signed-off-by: Markos Chandras <markos.chandras at imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 libc/sysdeps/linux/common/lstat64.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/libc/sysdeps/linux/common/lstat64.c b/libc/sysdeps/linux/common/lstat64.c
index 85e2698..c43e53e 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)


More information about the uClibc-cvs mailing list