Fix readdir regressions on sparc 32-bit.
authorDavid S. Miller <davem@davemloft.net>
Fri, 11 Oct 2013 05:32:36 +0000 (22:32 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 11 Oct 2013 05:32:36 +0000 (22:32 -0700)
* sysdeps/posix/dirstream.h (struct __dirstream): Fix alignment of
directory block.

ChangeLog
sysdeps/posix/dirstream.h

index fdc2f0b..5d99bd8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-10  David S. Miller  <davem@davemloft.net>
+
+       * sysdeps/posix/dirstream.h (struct __dirstream): Fix alignment of
+       directory block.
+
 2013-10-10  Joseph Myers  <joseph@codesourcery.com>
 
        * soft-fp/extendxftf2.c: Use copyright year range.  Use URL
index 8e8570d..be20895 100644 (file)
@@ -41,8 +41,13 @@ struct __dirstream
 
     int errcode;               /* Delayed error code.  */
 
-    /* Directory block.  */
-    char data[0] __attribute__ ((aligned (__alignof__ (void*))));
+    /* Directory block.  We must make sure that this block starts
+       at an address that is aligned adequately enough to store
+       dirent entries.  Using the alignment of "void *" is not
+       sufficient because dirents on 32-bit platforms can require
+       64-bit alignment.  We use "long double" here to be consistent
+       with what malloc uses.  */
+    char data[0] __attribute__ ((aligned (__alignof__ (long double))));
   };
 
 #define _DIR_dirfd(dirp)       ((dirp)->fd)