Re: [PATCH] getugroups: Add _GL_ATTRIBUTE_NONNULL_IF_NONZERO for grouplist
Rx <[email protected]>
| Newsgroups | gmane.comp.lib.gnulib.bugs |
|---|---|
| Message-ID | <[email protected]> |
21.08.2026 17:41, Bruno Haible пишет: > Paul Eggert wrote: >>> The NULL check of grouplist is replaced with a >>> maxcount check >> I don't see that in the patch. > That's because the implementation does not have a NULL check of grouplist, > in the first place. > > I have applied the patch, with a GNU-style ChangeLog entry and a commit > message that matches that ChangeLog entry. Thanks! > > Bruno I forgot to add it to the patch (or my IDE stripped it away during indexing). But it's actually here: diff --git a/lib/getugroups.c b/lib/getugroups.c index 6acb583fd9..4b2d67d101 100644 --- a/lib/getugroups.c +++ b/lib/getugroups.c @@ -83,7 +83,7 @@ getugroups (int maxcount, gid_t *grouplist, char const *username, /* See if this group number is already on the list. */ int n; for (n = 0; n < count; ++n) - if (grouplist && grouplist[n] == grp->gr_gid) + if (maxcount && grouplist[n] == grp->gr_gid) break; /* If it's a new group number, then try to add it to the list. */