From: Mike Gilbert Date: Sun, 26 Mar 2023 01:16:55 +0000 (-0400) Subject: usermod: respect --prefix for --gid option X-Git-Tag: 4.14.0-rc1~121 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd2d0079c90241f24671a7946a3ad175dc1a3aeb;p=thirdparty%2Fshadow.git usermod: respect --prefix for --gid option The --gid option accepts a group name or id. When a name is provided, it is resolved to an id by looking up the name in the group database (/etc/group). The --prefix option overides the location of the passwd and group databases. I suspect the --gid option was overlooked when wiring up the --prefix option. useradd --gid already respects --prefix; this change makes usermod behave the same way. Fixes: b6b2c756c91806b1c3e150ea0ee4721c6cdaf9d0 Signed-off-by: Mike Gilbert --- diff --git a/src/usermod.c b/src/usermod.c index 17cfac91b..05cc28fba 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -1072,7 +1072,7 @@ static void process_flags (int argc, char **argv) fflg = true; break; case 'g': - grp = getgr_nam_gid (optarg); + grp = prefix_getgr_nam_gid (optarg); if (NULL == grp) { fprintf (stderr, _("%s: group '%s' does not exist\n"),