[Glibc-bsd-commits] r3253 - trunk/glibc-ports/patches

Aurelien Jarno aurel32 at alioth.debian.org
Tue Feb 8 08:43:12 UTC 2011


Author: aurel32
Date: 2011-02-08 08:43:10 +0000 (Tue, 08 Feb 2011)
New Revision: 3253

Modified:
   trunk/glibc-ports/patches/readdir_r.patch
Log:
Update for glibc 2.13


Modified: trunk/glibc-ports/patches/readdir_r.patch
===================================================================
--- trunk/glibc-ports/patches/readdir_r.patch	2011-02-07 17:16:03 UTC (rev 3252)
+++ trunk/glibc-ports/patches/readdir_r.patch	2011-02-08 08:43:10 UTC (rev 3253)
@@ -4,17 +4,21 @@
 
 --- a/sysdeps/unix/readdir_r.c
 +++ b/sysdeps/unix/readdir_r.c
-@@ -113,7 +113,35 @@
-   while (dp->d_ino == 0);
+@@ -114,15 +114,32 @@
  
    if (dp != NULL)
--    *result = memcpy (entry, dp, reclen);
-+    {
-+      /* The required size of *entry, according to POSIX, is
-+	   offsetof (DIRENT_TYPE, d_name[0]) + NAME_MAX + 1.
-+	 We must not write beyond the end of *entry.  On some operating
-+	 systems, dp->d_reclen may be larger; in this case, copy only as
-+	 many bytes as needed.  Also give an error if d_name is too long.  */
+     {
+-#ifdef GETDENTS_64BIT_ALIGNED
+-      /* The d_reclen value might include padding which is not part of
+-	 the DIRENT_TYPE data structure.  */
+-      reclen = MIN (reclen,
+-		    offsetof (DIRENT_TYPE, d_name) + sizeof (dp->d_name));
+-#endif
++	/* The required size of *entry, according to POSIX, is
++	offsetof (DIRENT_TYPE, d_name[0]) + NAME_MAX + 1.
++	We must not write beyond the end of *entry.  On some operating
++	systems, dp->d_reclen may be larger; in this case, copy only as
++	many bytes as needed.  Also give an error if d_name is too long.  */
 +#ifdef _DIRENT_HAVE_D_RECLEN
 +      /* DIRENT_TYPE is of variable size, with d_name as its last entry.  */
 +      size_t namelen;
@@ -29,15 +33,15 @@
 +			  offsetof (DIRENT_TYPE, d_name[0]) + namelen + 1);
 +      else
 +	{
-+	  errno = EOVERFLOW;
-+	  dp = NULL;
-+	  *result = NULL;
-+	}
++          errno = EOVERFLOW;
++          dp = NULL;
++          *result = NULL;
++        }
 +#else
 +      /* DIRENT_TYPE is of fixed size.  */
-+      *result = memcpy (entry, dp, reclen);
-+#endif
-+    }
+       *result = memcpy (entry, dp, reclen);
+-#ifdef GETDENTS_64BIT_ALIGNED
+-      entry->d_reclen = reclen;
+ #endif
+     }
    else
-     *result = NULL;
- 




More information about the Glibc-bsd-commits mailing list