aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pw
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
commitf4124312a11597ce61b918879185984e8bcb427a (patch)
tree49bab21323d39b8e5798bb9e45bc68fdc744bda6 /usr.sbin/pw
parenta64b90fbaa161ec68aec69bec110e0cdab7b4dd3 (diff)
downloadsrc-f4124312a11597ce61b918879185984e8bcb427a.tar.gz
src-f4124312a11597ce61b918879185984e8bcb427a.zip
Fix regression: report if a group already exists when creating it
Notes
Notes: svn path=/head/; revision=286199
Diffstat (limited to 'usr.sbin/pw')
-rw-r--r--usr.sbin/pw/pw_group.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.sbin/pw/pw_group.c b/usr.sbin/pw/pw_group.c
index 5ba5e39fa06d..22e80b0cc2d3 100644
--- a/usr.sbin/pw/pw_group.c
+++ b/usr.sbin/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);