OSDN Git Service

lstat64: Use fstatat64 if arch does not have the lstat64 syscall
authorMarkos Chandras <markos.chandras@imgtec.com>
Thu, 11 Oct 2012 11:30:56 +0000 (12:30 +0100)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Wed, 20 Feb 2013 12:45:13 +0000 (13:45 +0100)
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
libc/sysdeps/linux/common/lstat64.c

index 85e2698..c43e53e 100644 (file)
 #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)