--- shadow-4.0.18.2/src/useradd.c +++ shadow-4.0.18.2/src/useradd.c @@ -203,14 +203,18 @@ long gid; char *errptr; + struct group* grp = getgrnam (grname); + if (grp) + return grp; + gid = strtol (grname, &errptr, 10); if (*errptr || errno == ERANGE || gid < 0) { fprintf (stderr, _("%s: invalid numeric argument '%s'\n"), Prog, grname); exit (E_BAD_ARG); } - return getgrnam (grname); + return getgrgid (gid); } static long get_number (const char *numstr)