mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-13 00:30:07 +00:00
(getgrouplist): Simplify code a bit. Don't allocate one additional
element on NEWGROUPS.
This commit is contained in:
parent
6c215a8d6c
commit
39571a1360
@ -1,8 +1,10 @@
|
|||||||
2006-08-03 Ulrich Drepper <drepper@redhat.com>
|
2006-08-03 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
|
||||||
* grp/initgroups.c (internal_getgrouplist): Remove unnecessary
|
* grp/initgroups.c (internal_getgrouplist): Remove unnecessary
|
||||||
test introduced in patch for bz #661.
|
test introduced in patch for bz #661.
|
||||||
(getgrouplist): Simplify code a bit.
|
(getgrouplist): Simplify code a bit. Don't allocate one additional
|
||||||
|
element on NEWGROUPS.
|
||||||
|
|
||||||
[BZ #2908]
|
[BZ #2908]
|
||||||
* stdio-common/printf_fphex.c (__printf_fphex): When rounding up
|
* stdio-common/printf_fphex.c (__printf_fphex): When rounding up
|
||||||
|
@ -144,7 +144,7 @@ getgrouplist (const char *user, gid_t group, gid_t *groups, int *ngroups)
|
|||||||
{
|
{
|
||||||
long int size = MAX (1, *ngroups);
|
long int size = MAX (1, *ngroups);
|
||||||
|
|
||||||
gid_t *newgroups = (gid_t *) malloc ((size + 1) * sizeof (gid_t));
|
gid_t *newgroups = (gid_t *) malloc (size * sizeof (gid_t));
|
||||||
if (__builtin_expect (newgroups == NULL, 0))
|
if (__builtin_expect (newgroups == NULL, 0))
|
||||||
/* No more memory. */
|
/* No more memory. */
|
||||||
// XXX This is wrong. The user provided memory, we have to use
|
// XXX This is wrong. The user provided memory, we have to use
|
||||||
|
Loading…
Reference in New Issue
Block a user