From: Markos Chandras <[email protected]>
Signed-off-by: Markos Chandras <[email protected]>
---
libc/sysdeps/linux/common/lstat.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/libc/sysdeps/linux/common/lstat.c
b/libc/sysdeps/linux/common/lstat.c
index db72d1f..9f086f4 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.8.0
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc