mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-25 06:20:06 +00:00
* sysdeps/unix/opendir.c (__alloc_dir): Don't initialize ->data.
Avoid memset, add explicit initialization. * sysdeps/unix/dirstream.h (struct __dirstream): Move data elemtn to the end and change into zero-sized array. Move lock member to fill a hole on 64-bit platforms.
This commit is contained in:
parent
9b2e9577b2
commit
fa39685d5c
@ -1,7 +1,10 @@
|
||||
2007-08-02 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* sysdeps/unix/dirstream.h (struct __dirstream): Move lock member
|
||||
to fill a hole on 64-bit platforms.
|
||||
* sysdeps/unix/opendir.c (__alloc_dir): Don't initialize ->data.
|
||||
Avoid memset, add explicit initialization.
|
||||
* sysdeps/unix/dirstream.h (struct __dirstream): Move data elemtn
|
||||
to the end and change into zero-sized array.
|
||||
Move lock member to fill a hole on 64-bit platforms.
|
||||
|
||||
* stdlib/stdlib.h: Remove __strto*_internal prototypes and strto*
|
||||
inline functions.
|
||||
|
@ -17,7 +17,6 @@
|
||||
02111-1307 USA. */
|
||||
|
||||
#ifndef _DIRSTREAM_H
|
||||
|
||||
#define _DIRSTREAM_H 1
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -35,12 +34,14 @@ struct __dirstream
|
||||
|
||||
__libc_lock_define (, lock) /* Mutex lock for this structure. */
|
||||
|
||||
char *data; /* Directory block. */
|
||||
size_t allocation; /* Space allocated for the block. */
|
||||
size_t size; /* Total valid data in the block. */
|
||||
size_t offset; /* Current offset into the block. */
|
||||
|
||||
off_t filepos; /* Position of next entry to read. */
|
||||
|
||||
/* Directory block. */
|
||||
char data[0] __attribute__ ((aligned (__alignof__ (void*))));
|
||||
};
|
||||
|
||||
#define _DIR_dirfd(dirp) ((dirp)->fd)
|
||||
|
@ -155,9 +155,7 @@ __alloc_dir (int fd, bool close_fd, const struct stat64 *statp)
|
||||
allocation = (BUFSIZ < sizeof (struct dirent64)
|
||||
? sizeof (struct dirent64) : BUFSIZ);
|
||||
|
||||
const int pad = -sizeof (DIR) % __alignof__ (struct dirent64);
|
||||
|
||||
DIR *dirp = (DIR *) malloc (sizeof (DIR) + allocation + pad);
|
||||
DIR *dirp = (DIR *) malloc (sizeof (DIR) + allocation);
|
||||
if (dirp == NULL)
|
||||
lose:
|
||||
{
|
||||
@ -169,14 +167,15 @@ __alloc_dir (int fd, bool close_fd, const struct stat64 *statp)
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
memset (dirp, '\0', sizeof (DIR));
|
||||
dirp->data = (char *) (dirp + 1) + pad;
|
||||
dirp->allocation = allocation;
|
||||
dirp->fd = fd;
|
||||
|
||||
dirp->allocation = allocation;
|
||||
#ifndef NOT_IN_libc
|
||||
__libc_lock_init (dirp->lock);
|
||||
#endif
|
||||
dirp->fd = fd;
|
||||
dirp->size = 0;
|
||||
dirp->offset = 0;
|
||||
dirp->filepos = 0;
|
||||
|
||||
return dirp;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user