about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-10-10 22:32:36 -0700
committerDavid S. Miller <davem@davemloft.net>2013-10-10 22:32:36 -0700
commit75b4202ab03337edb37536e3d9470a48a04c9341 (patch)
tree5e187d42c32db5c190b00009bed479a6a39b8a0e /sysdeps
parent33b853c3b19a2a75f720f9fca312a651ab17728a (diff)
downloadglibc-75b4202ab03337edb37536e3d9470a48a04c9341.tar.gz
glibc-75b4202ab03337edb37536e3d9470a48a04c9341.tar.xz
glibc-75b4202ab03337edb37536e3d9470a48a04c9341.zip
Fix readdir regressions on sparc 32-bit.
	* sysdeps/posix/dirstream.h (struct __dirstream): Fix alignment of
	directory block.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/posix/dirstream.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/sysdeps/posix/dirstream.h b/sysdeps/posix/dirstream.h
index 8e8570dd48..be20895051 100644
--- a/sysdeps/posix/dirstream.h
+++ b/sysdeps/posix/dirstream.h
@@ -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)