From 533101a268dc5015a140ff4695d8eeb04fbe57b6 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 Oct 2013 23:08:42 -0700 Subject: [PATCH] mgetgroups: remove dependency on realloc-gnu The dependency violates the comment in realloc-gnu, which says that tests can't depend on realloc-gnu; some tests depend on mgetgroups, so mgetgroups can't depend on realloc-gnu. Problem reported by Daniel Richard G. in . * lib/mgetgroups.c (mgetgroups): Don't call realloc (NULL, 0). * modules/mgetgroups (Depends-on): Depend on realloc-posix, not realloc-gnu. --- ChangeLog | 12 ++++++++++++ lib/mgetgroups.c | 2 +- modules/mgetgroups | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e3e514cfa..ad2b14148 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2013-10-13 Paul Eggert + + mgetgroups: remove dependency on realloc-gnu + The dependency violates the comment in realloc-gnu, which + says that tests can't depend on realloc-gnu; some tests depend + on mgetgroups, so mgetgroups can't depend on realloc-gnu. + Problem reported by Daniel Richard G. in + . + * lib/mgetgroups.c (mgetgroups): Don't call realloc (NULL, 0). + * modules/mgetgroups (Depends-on): Depend on realloc-posix, + not realloc-gnu. + 2013-10-12 Paul Eggert regex-tests: port to HP-UX 11.11 diff --git a/lib/mgetgroups.c b/lib/mgetgroups.c index 2d82f45cd..846662b7f 100644 --- a/lib/mgetgroups.c +++ b/lib/mgetgroups.c @@ -133,7 +133,7 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups) return -1; } - if (!username && gid != (gid_t) -1) + if (max_n_groups == 0 || (!username && gid != (gid_t) -1)) max_n_groups++; g = realloc_groupbuf (NULL, max_n_groups); if (g == NULL) diff --git a/modules/mgetgroups b/modules/mgetgroups index 76eee0140..f401cdfa8 100644 --- a/modules/mgetgroups +++ b/modules/mgetgroups @@ -9,7 +9,7 @@ m4/mgetgroups.m4 Depends-on: getgroups getugroups -realloc-gnu +realloc-posix xalloc-oversized configure.ac: -- 2.11.0