diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-05-10 09:23:03 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-05-10 09:23:03 +0000 |
commit | 35ddfb6d6c8c9b50507936e4ac89408e4792de54 (patch) | |
tree | 96f803cd162001ebf29e72089dc5af84337ace73 | |
parent | b1a215787d60cfffd7272c5550a07cc0b89f05e5 (diff) | |
download | src-35ddfb6d6c8c9b50507936e4ac89408e4792de54.tar.gz src-35ddfb6d6c8c9b50507936e4ac89408e4792de54.zip |
The pwdb function is only used once to check the database rename it
pwdb_check and simplify it accordingly
Notes
Notes:
svn path=/head/; revision=282713
-rw-r--r-- | usr.sbin/pw/pwupd.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/usr.sbin/pw/pwupd.c b/usr.sbin/pw/pwupd.c index 51d732ee3cc6..710e901cb061 100644 --- a/usr.sbin/pw/pwupd.c +++ b/usr.sbin/pw/pwupd.c @@ -33,7 +33,6 @@ static const char rcsid[] = #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <stdarg.h> #include <pwd.h> #include <libutil.h> #include <errno.h> @@ -72,19 +71,15 @@ getpwpath(char const * file) } static int -pwdb(char *arg,...) +pwdb_check(void) { int i = 0; pid_t pid; - va_list ap; char *args[10]; args[i++] = _PATH_PWD_MKDB; - va_start(ap, arg); - while (i < 6 && arg != NULL) { - args[i++] = arg; - arg = va_arg(ap, char *); - } + args[i++] = "-C"; + if (pwpath != pathpwd) { args[i++] = "-d"; args[i++] = pwpath; @@ -102,7 +97,6 @@ pwdb(char *arg,...) if (WEXITSTATUS(i)) i = EIO; } - va_end(ap); return (i); } @@ -114,7 +108,7 @@ pw_update(struct passwd * pwd, char const * user) struct passwd *old_pw = NULL; int rc, pfd, tfd; - if ((rc = pwdb("-C", NULL)) != 0) + if ((rc = pwdb_check()) != 0) return (rc); if (pwd != NULL) |