Fix regression: report if a group already exists when creating it

This commit is contained in:
bapt 2015-08-02 12:56:25 +00:00
parent 521095bbe7
commit 4453f16adb

View File

@ -546,6 +546,8 @@ pw_group_add(int argc, char **argv, char *arg1)
freopen(_PATH_DEVNULL, "w", stderr);
if (name == NULL)
errx(EX_DATAERR, "group name required");
if (GETGRNAM(name) != NULL)
errx(EX_DATAERR, "group name `%s' already exists", name);
cnf = get_userconfig(cfg);
rc = groupadd(cnf, name, gr_gidpolicy(cnf, id), members, fd, dryrun,
pretty, precrypted);