logo

utils-std

Collection of commonly available Unix tools
commit: 8fb74af81e0cb41388447a8ec5a3a34cb61c2702
parent 22dfbb18eb5f9d669a809044b9ec42e8f29805ed
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Wed, 10 Jul 2024 02:23:33 +0200

cmd/id: Fix usage of getgrouplist(3) return value as size

getgrouplist(3) returns -1 or 0, not size which it sets via it's 4th argument.

Diffstat:

Mcmd/id.c4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cmd/id.c b/cmd/id.c @@ -219,12 +219,12 @@ main(int argc, char *argv[]) egid = epw.pw_gid; // Can only get groups from configuration - ngroups = getgrouplist(pw.pw_name, pw.pw_gid, groups, &ngroups_max); - if(ngroups < 0) + if(getgrouplist(pw.pw_name, pw.pw_gid, groups, &ngroups_max) < 0) { perror("id: getgrouplist"); goto failure; } + ngroups = ngroups_max; } else {