Use fstat64 to work out the size of a file if it is available as it
copes with a wider range of filesystems than the old fstat call.
Fixes bug #130020.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5979 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c
index 82e2972..f84a1c2 100644
--- a/coregrind/m_libcfile.c
+++ b/coregrind/m_libcfile.c
@@ -133,8 +133,13 @@
Int VG_(fsize) ( Int fd )
{
+#ifdef __NR_fstat64
+ struct vki_stat64 buf;
+ SysRes res = VG_(do_syscall2)(__NR_fstat64, fd, (UWord)&buf);
+#else
struct vki_stat buf;
SysRes res = VG_(do_syscall2)(__NR_fstat, fd, (UWord)&buf);
+#endif
return res.isError ? (-1) : buf.st_size;
}