From f87aeed8e4c049e6510accf0e0dfab0d29b7f27f Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Sun, 10 May 2015 09:23:03 +0000 Subject: The pwdb function is only used once to check the database rename it pwdb_check and simplify it accordingly --- pw/pwupd.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'pw/pwupd.c') diff --git a/pw/pwupd.c b/pw/pwupd.c index 51d732e..710e901 100644 --- a/pw/pwupd.c +++ b/pw/pwupd.c @@ -33,7 +33,6 @@ static const char rcsid[] = #include #include #include -#include #include #include #include @@ -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) -- cgit v1.2.3