about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2010-09-21 14:02:08 -0700
committerPetr Baudis <pasky@suse.cz>2010-11-09 02:17:40 +0100
commitbca48e9a92242428acd6ffa9da6b4739eae4188b (patch)
treea85450efa27d1149421c9caa9f260adbc73e8639
parentdca25feaf72a073df5ca7cca4de5e5d0fccacc36 (diff)
downloadglibc-bca48e9a92242428acd6ffa9da6b4739eae4188b.tar.gz
glibc-bca48e9a92242428acd6ffa9da6b4739eae4188b.tar.xz
glibc-bca48e9a92242428acd6ffa9da6b4739eae4188b.zip
getdents64 fallback d_type support
(cherry picked from commit 1ac7a2c7b448c851eb8976fcc290a906a4075203)
-rw-r--r--ChangeLog6
-rw-r--r--sysdeps/unix/sysv/linux/getdents.c6
2 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 5800ca49e6..71027458c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-09-15  Joseph Myers  <joseph@codesourcery.com>
+
+	* sysdeps/unix/sysv/linux/getdents.c (__GETDENTS): When
+	implementing getdents64 using getdents syscall, set d_type if
+	__ASSUME_GETDENTS32_D_TYPE.
+
 2010-09-14  Andreas Schwab  <schwab@redhat.com>
 
 	* sysdeps/s390/s390-32/__longjmp.c (__longjmp): Define register
diff --git a/sysdeps/unix/sysv/linux/getdents.c b/sysdeps/unix/sysv/linux/getdents.c
index b33d1789ad..0aa918677d 100644
--- a/sysdeps/unix/sysv/linux/getdents.c
+++ b/sysdeps/unix/sysv/linux/getdents.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995-2003, 2004, 2006, 2007
+/* Copyright (C) 1993, 1995-2004, 2006, 2007, 2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -285,7 +285,11 @@ __GETDENTS (int fd, char *buf, size_t nbytes)
 	DIRENT_SET_DP_INO(dp, kdp->d_ino);
 	dp->d_off = kdp->d_off;
 	dp->d_reclen = new_reclen;
+#ifdef __ASSUME_GETDENTS32_D_TYPE
+	dp->d_type = *((char *) kdp + kdp->d_reclen - 1);
+#else
 	dp->d_type = DT_UNKNOWN;
+#endif
 	memcpy (dp->d_name, kdp->d_name,
 		kdp->d_reclen - offsetof (struct kernel_dirent, d_name));