From: Markos Chandras <markos.chand...@imgtec.com>

Signed-off-by: Markos Chandras <markos.chand...@imgtec.com>
---
 libc/sysdeps/linux/common/lstat.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/libc/sysdeps/linux/common/lstat.c 
b/libc/sysdeps/linux/common/lstat.c
index db72d1f..753dc4e 100644
--- a/libc/sysdeps/linux/common/lstat.c
+++ b/libc/sysdeps/linux/common/lstat.c
@@ -8,10 +8,20 @@
  */
 
 #include <sys/syscall.h>
+#include <fcntl.h>
 #include <unistd.h>
 #include <sys/stat.h>
 #include "xstatconv.h"
 
+#if defined(__NR_fstatat64) && ! defined(__NR_lstat)
+int lstat(const char* file_name, struct stat* buf)
+{
+       return fstatat(AT_FDCWD, file_name, buf, AT_SYMLINK_NOFOLLOW);
+}
+libc_hidden_def(lstat)
+
+/* For systems which have both, prefer the old one */
+#else
 int lstat(const char *file_name, struct stat *buf)
 {
        int result;
@@ -33,12 +43,15 @@ int lstat(const char *file_name, struct stat *buf)
        if (result == 0) {
                __xstat_conv(&kbuf, buf);
        }
-#endif
+#endif /* __NR_lstat64 */
        return result;
 }
 libc_hidden_def(lstat)
 
-#if ! defined __NR_lstat64 && defined __UCLIBC_HAS_LFS__
+#if ! defined __NR_fstatat64 && ! defined __NR_lstat64 \
+       && defined __UCLIBC_HAS_LFS__
 strong_alias_untyped(lstat,lstat64)
 libc_hidden_def(lstat64)
 #endif
+
+#endif /* __NR_fstatat64 */
-- 
1.7.1


_______________________________________________
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to