From: Alejandro Colomar Date: Mon, 22 Jan 2024 22:52:09 +0000 (+0100) Subject: src/usermod.c: grp_update(): Remove scope of variable, and fix const correctness X-Git-Tag: 4.15.0-rc1~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d452d1b812456826d63b90f39ea029309b64ff43;p=thirdparty%2Fshadow.git src/usermod.c: grp_update(): Remove scope of variable, and fix const correctness Signed-off-by: Alejandro Colomar --- diff --git a/src/usermod.c b/src/usermod.c index 76955c25c..d42dbf8c7 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -971,7 +971,6 @@ static void grp_update (void) */ static void process_flags (int argc, char **argv) { - const struct group *grp; struct stat st; bool anyflag = false; @@ -1077,6 +1076,9 @@ static void process_flags (int argc, char **argv) fflg = true; break; case 'g': + { + struct group *grp; + grp = prefix_getgr_nam_gid (optarg); if (NULL == grp) { fprintf (stderr, @@ -1088,6 +1090,7 @@ static void process_flags (int argc, char **argv) gflg = true; gr_free (grp); break; + } case 'G': if (get_groups (optarg) != 0) { exit (E_NOTFOUND);