Skip to content

Commit

Permalink
lib/addgrps.c: add_groups(): Simplify redundant code with a goto
Browse files Browse the repository at this point in the history
Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
  • Loading branch information
alejandro-colomar authored and hallyn committed Jan 24, 2025
1 parent 1fd1bb4 commit a2841ce
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/addgrps.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,8 @@ add_groups(const char *list)
}

if (added) {
int ret;

ret = setgroups (ngroups, grouplist);
free (grouplist);
return ret;
if (setgroups(ngroups, grouplist) == -1)
goto free_gids;
}

free (grouplist);
Expand Down

0 comments on commit a2841ce

Please sign in to comment.