summaryrefslogtreecommitdiff
path: root/usr.sbin/user/user.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/user/user.c')
-rw-r--r--usr.sbin/user/user.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/usr.sbin/user/user.c b/usr.sbin/user/user.c
index d92e651c550..f6599c86d84 100644
--- a/usr.sbin/user/user.c
+++ b/usr.sbin/user/user.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: user.c,v 1.88 2012/01/28 10:20:01 ajacoutot Exp $ */
+/* $OpenBSD: user.c,v 1.89 2012/01/28 14:25:45 ajacoutot Exp $ */
/* $NetBSD: user.c,v 1.69 2003/04/14 17:40:07 agc Exp $ */
/*
@@ -1522,22 +1522,22 @@ moduser(char *login_name, char *newlogin, user_t *up)
err(EXIT_FAILURE, "can't move `%s' to `%s'",
homedir, pwp->pw_dir);
}
- if (up->u_groupc > 0) {
- if (up->u_flags & F_SETSECGROUP) {
- for (i = 0 ; i < up->u_groupc ; i++) {
- if ((grp = getgrnam(up->u_groupv[i])) == NULL) {
- (void) close(ptmpfd);
- pw_abort();
- errx(EXIT_FAILURE, "aborting, group `%s' does not exist",
- up->u_groupv[i]);
- }
- }
- if (!rm_user_from_groups(newlogin)) {
+ if (up->u_flags & F_SETSECGROUP) {
+ for (i = 0 ; i < up->u_groupc ; i++) {
+ if ((grp = getgrnam(up->u_groupv[i])) == NULL) {
(void) close(ptmpfd);
pw_abort();
- errx(EXIT_FAILURE, "can't reset groups for `%s'", newlogin);
+ errx(EXIT_FAILURE, "aborting, group `%s' does not exist",
+ up->u_groupv[i]);
}
}
+ if (!rm_user_from_groups(newlogin)) {
+ (void) close(ptmpfd);
+ pw_abort();
+ errx(EXIT_FAILURE, "can't reset groups for `%s'", newlogin);
+ }
+ }
+ if (up->u_groupc > 0) {
if (!append_group(newlogin, up->u_groupc, up->u_groupv)) {
(void) close(ptmpfd);
pw_abort();