GNU C Library master sources branch, master, updated. glibc-2.11-314-g1a81139

drepper@sourceware.org drepper@sourceware.org
Sun Apr 4 06:54:00 GMT 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  1a81139728494810f65aaa0d0c538ff8c2783dd5 (commit)
      from  3fedf0feb75457f7098a0119ca4203ff449546b6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1a81139728494810f65aaa0d0c538ff8c2783dd5

commit 1a81139728494810f65aaa0d0c538ff8c2783dd5
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Sat Apr 3 23:51:40 2010 -0700

    Handle unnecessary padding in getdents64.
    
    The getdents64 syscall adds on 32-but platforms padding which isn't needed
    and not included in the userlevel data structure definition.  We have to
    avoid copying those padding bytes in the readdir64_r function.

diff --git a/ChangeLog b/ChangeLog
index 2b735fc..91ae105 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-04-03  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #11333]
+	* sysdeps/unix/readdir_r.c (__READDIR_R): Add support for platforms
+	which include unnecessary padding in d_reclen.
+	* sysdeps/unix/sysv/linux/i386/readdir64_r.c: Select work-around for
+	unnecessary padding.
+
 	[BZ #11387]
 	* sysdeps/unix/sysv/linux/ifaddrs.c (map_newlin): Don't abort on
 	unknown interface, return -1.
diff --git a/sysdeps/unix/readdir_r.c b/sysdeps/unix/readdir_r.c
index f84709e..9372791 100644
--- a/sysdeps/unix/readdir_r.c
+++ b/sysdeps/unix/readdir_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2000,02
+/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2000,02,10
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -113,7 +113,17 @@ __READDIR_R (DIR *dirp, DIRENT_TYPE *entry, DIRENT_TYPE **result)
   while (dp->d_ino == 0);
 
   if (dp != NULL)
-    *result = memcpy (entry, dp, reclen);
+    {
+#ifdef GETDENTS_64BIT_ALIGNED
+      /* The d_reclen value might include padding which is not part of
+	 the DIRENT_TYPE data structure.  */
+      reclen = MIN (reclen, sizeof (DIRENT_TYPE));
+#endif
+      *result = memcpy (entry, dp, reclen);
+#ifdef GETDENTS_64BIT_ALIGNED
+      entry->d_reclen = reclen;
+#endif
+    }
   else
     *result = NULL;
 
diff --git a/sysdeps/unix/sysv/linux/i386/readdir64_r.c b/sysdeps/unix/sysv/linux/i386/readdir64_r.c
index c6da57b..f96f16a 100644
--- a/sysdeps/unix/sysv/linux/i386/readdir64_r.c
+++ b/sysdeps/unix/sysv/linux/i386/readdir64_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2004, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -19,6 +19,7 @@
 #define __READDIR_R __readdir64_r
 #define __GETDENTS __getdents64
 #define DIRENT_TYPE struct dirent64
+#define GETDENTS_64BIT_ALIGNED 1
 
 #include <sysdeps/unix/readdir_r.c>
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                  |    6 ++++++
 sysdeps/unix/readdir_r.c                   |   14 ++++++++++++--
 sysdeps/unix/sysv/linux/i386/readdir64_r.c |    3 ++-
 3 files changed, 20 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources



More information about the Glibc-cvs mailing list