about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/fxstat64.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/fxstat64.c')
-rw-r--r--sysdeps/unix/sysv/linux/fxstat64.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/sysdeps/unix/sysv/linux/fxstat64.c b/sysdeps/unix/sysv/linux/fxstat64.c
index 3cd21d4fc4..2140661ff3 100644
--- a/sysdeps/unix/sysv/linux/fxstat64.c
+++ b/sysdeps/unix/sysv/linux/fxstat64.c
@@ -43,13 +43,20 @@ extern int __have_no_stat64;
 #endif
 
 /* Get information about the file FD in BUF.  */
+extern int ___fxstat64 (int vers, int fd, struct stat64 *buf);
+
 int
-__fxstat64 (int vers, int fd, struct stat64 *buf)
+___fxstat64 (int vers, int fd, struct stat64 *buf)
 {
+  int result;
 #if __ASSUME_STAT64_SYSCALL > 0
-  return INLINE_SYSCALL (fstat64, 2, fd, CHECK_1 (buf));
+  result = INLINE_SYSCALL (fstat64, 2, fd, CHECK_1 (buf));
+# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0
+  if (!result && buf->__st_ino != (__ino_t) buf->st_ino)
+    buf->st_ino = buf->__st_ino;
+# endif
+  return result;
 #else
-  int result;
   struct kernel_stat kbuf;
 # if defined __NR_fstat64
   if (! __have_no_stat64)
@@ -58,7 +65,13 @@ __fxstat64 (int vers, int fd, struct stat64 *buf)
       result = INLINE_SYSCALL (fstat64, 2, fd, CHECK_1 (buf));
 
       if (result != -1 || errno != ENOSYS)
-	return result;
+	{
+#  if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0
+	  if (!result && buf->__st_ino != (__ino_t)buf->st_ino)
+	    buf->st_ino = buf->__st_ino;
+#  endif
+	  return result;
+	}
 
       __set_errno (saved_errno);
       __have_no_stat64 = 1;
@@ -71,3 +84,12 @@ __fxstat64 (int vers, int fd, struct stat64 *buf)
   return result;
 #endif
 }
+
+#include <shlib-compat.h>
+
+versioned_symbol (libc, ___fxstat64, __fxstat64, GLIBC_2_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+strong_alias (___fxstat64, __old__fxstat64)
+compat_symbol (libc, __old__fxstat64, __fxstat64, GLIBC_2_1);
+#endif