]> git.cameronkatri.com Git - pw-darwin.git/commitdiff
Fix regression: report if a group already exists when creating it
authorBaptiste Daroussin <bapt@FreeBSD.org>
Sun, 2 Aug 2015 12:56:25 +0000 (12:56 +0000)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Sun, 2 Aug 2015 12:56:25 +0000 (12:56 +0000)
pw/pw_group.c

index 5ba5e39fa06d254b9ea00c3b636edc4dd614455f..22e80b0cc2d3006fa2ff07958179c7a07810aa21 100644 (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);