lib/, src/: get_gid(): Use the usual -1 as an error code

Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2023-12-02 00:23:06 +01:00
committed by Serge Hallyn
parent ea253cb275
commit 470baeabbd
6 changed files with 11 additions and 8 deletions

View File

@@ -403,7 +403,7 @@ static void process_flags (int argc, char **argv)
break;
case 'g':
gflg = true;
if ( (get_gid (optarg, &group_id) == 0)
if ( (get_gid(optarg, &group_id) == -1)
|| (group_id == (gid_t)-1)) {
fprintf (stderr,
_("%s: invalid group ID '%s'\n"),

View File

@@ -414,7 +414,7 @@ static void process_flags (int argc, char **argv)
break;
case 'g':
gflg = true;
if ( (get_gid (optarg, &group_newid) == 0)
if ( (get_gid(optarg, &group_newid) == -1)
|| (group_newid == (gid_t)-1)) {
fprintf (stderr,
_("%s: invalid group ID '%s'\n"),

View File

@@ -239,7 +239,7 @@ static int add_group (const char *name, const char *gid, gid_t *ngid, uid_t uid)
* new group, or an existing group.
*/
if (get_gid (gid, &grent.gr_gid) == 0) {
if (get_gid(gid, &grent.gr_gid) == -1) {
fprintf (stderr,
_("%s: invalid group ID '%s'\n"),
Prog, gid);