summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-08-02 12:56:25 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-08-02 12:56:25 +0000
commita210ad360e3bebc7be4230459986be42e8490810 (patch)
treea441df5f88dad941d3cda3632e8bc00654919a69
parentcb594395fed248af762f0a270e4d2efe87028825 (diff)
downloadpw-darwin-a210ad360e3bebc7be4230459986be42e8490810.tar.gz
pw-darwin-a210ad360e3bebc7be4230459986be42e8490810.tar.zst
pw-darwin-a210ad360e3bebc7be4230459986be42e8490810.zip
Fix regression: report if a group already exists when creating it
-rw-r--r--pw/pw_group.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/pw/pw_group.c b/pw/pw_group.c
index 5ba5e39..22e80b0 100644
--- a/pw/pw_group.c
+++ b/pw/pw_group.c
@@ -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);