mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-26 23:10:06 +00:00
Update.
2003-08-27 Jakub Jelinek <jakub@redhat.com> * sysdeps/unix/opendir.c (__opendir): Make sure even struct dirent64 fits into allocation. Add padding on 32-bit arches so that dirp->data is enough aligned for struct dirent64. Avoid clearing of the buffer, just clear DIR structure.
This commit is contained in:
parent
5556fc6ae4
commit
45c24c0654
@ -1,3 +1,10 @@
|
||||
2003-08-27 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* sysdeps/unix/opendir.c (__opendir): Make sure even struct dirent64
|
||||
fits into allocation. Add padding on 32-bit arches so that
|
||||
dirp->data is enough aligned for struct dirent64.
|
||||
Avoid clearing of the buffer, just clear DIR structure.
|
||||
|
||||
2003-08-26 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* nss/nsswitch.c: Add libc_hidden_def for __nss_lookup_function.
|
||||
|
@ -137,15 +137,17 @@ __opendir (const char *name)
|
||||
goto lose;
|
||||
|
||||
#ifdef _STATBUF_ST_BLKSIZE
|
||||
if (__builtin_expect ((size_t) statbuf.st_blksize >= sizeof (struct dirent),
|
||||
if (__builtin_expect ((size_t) statbuf.st_blksize >= sizeof (struct dirent64),
|
||||
1))
|
||||
allocation = statbuf.st_blksize;
|
||||
else
|
||||
#endif
|
||||
allocation = (BUFSIZ < sizeof (struct dirent)
|
||||
? sizeof (struct dirent) : BUFSIZ);
|
||||
allocation = (BUFSIZ < sizeof (struct dirent64)
|
||||
? sizeof (struct dirent64) : BUFSIZ);
|
||||
|
||||
dirp = (DIR *) calloc (1, sizeof (DIR) + allocation); /* Zero-fill. */
|
||||
const int pad = -sizeof (DIR) % __alignof__ (struct dirent64);
|
||||
|
||||
dirp = (DIR *) malloc (sizeof (DIR) + allocation + pad);
|
||||
if (dirp == NULL)
|
||||
lose:
|
||||
{
|
||||
@ -154,7 +156,8 @@ __opendir (const char *name)
|
||||
__set_errno (save_errno);
|
||||
return NULL;
|
||||
}
|
||||
dirp->data = (char *) (dirp + 1);
|
||||
memset (dirp, '\0', sizeof (DIR));
|
||||
dirp->data = (char *) (dirp + 1) + pad;
|
||||
dirp->allocation = allocation;
|
||||
dirp->fd = fd;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user