Skip to content

Commit bd2d007

Browse files
floppymikerexxe
authored andcommitted
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: b6b2c75 Signed-off-by: Mike Gilbert <[email protected]>
1 parent 4c210a2 commit bd2d007

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/usermod.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ static void process_flags (int argc, char **argv)
10721072
fflg = true;
10731073
break;
10741074
case 'g':
1075-
grp = getgr_nam_gid (optarg);
1075+
grp = prefix_getgr_nam_gid (optarg);
10761076
if (NULL == grp) {
10771077
fprintf (stderr,
10781078
_("%s: group '%s' does not exist\n"),

0 commit comments

Comments
 (0)