summaryrefslogtreecommitdiff
path: root/usr.sbin/user/user.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-11-26 01:29:44 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-11-26 01:29:44 +0000
commit0833960ec5375df11695c85f9ee7ac29a2001cbf (patch)
tree6e5bd2c214a08ac12099061f8baa8c99002dc7e5 /usr.sbin/user/user.c
parent19054405341f0d0f83f6550fada15989c0fea2df (diff)
Update for pw_mkdb(3) interface change. All but vipw and userdel can
specify a username (and thus avoid rebuilding the while database).
Diffstat (limited to 'usr.sbin/user/user.c')
-rw-r--r--usr.sbin/user/user.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/user/user.c b/usr.sbin/user/user.c
index 09af2aad3fc..344a2e21a25 100644
--- a/usr.sbin/user/user.c
+++ b/usr.sbin/user/user.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: user.c,v 1.17 2000/07/15 08:31:54 ho Exp $ */
+/* $OpenBSD: user.c,v 1.18 2000/11/26 01:29:42 millert Exp $ */
/* $NetBSD: user.c,v 1.17 2000/04/14 06:26:55 simonb Exp $ */
/*
@@ -854,7 +854,7 @@ adduser(char *login, user_t *up)
"failed to modify secondary groups for login %s", login);
}
(void) close(ptmpfd);
- if (pw_mkdb() < 0) {
+ if (pw_mkdb(login) < 0) {
err(EXIT_FAILURE, "pw_mkdb failed");
}
return 1;
@@ -1024,7 +1024,11 @@ moduser(char *login, char *newlogin, user_t *up)
err(EXIT_FAILURE, "can't move `%s' to `%s'", oldhome, home);
}
(void) close(ptmpfd);
- if (pw_mkdb() < 0) {
+ if (up != (user_t *) NULL && strcmp(login, newlogin) == 0)
+ cc = pw_mkdb(login);
+ else
+ cc = pw_mkdb(NULL);
+ if (cc < 0) {
err(EXIT_FAILURE, "pw_mkdb failed");
}
return 1;