summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-05-10 09:23:03 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-05-10 09:23:03 +0000
commit9001ce8b2e811f82e7d91341502d895d770fc112 (patch)
tree89cb00006fc91733d337cf9b1130dffd958a67ae
parent8355e4f75608c306775f9bb76be827c99ca8b9ba (diff)
downloadpw-darwin-9001ce8b2e811f82e7d91341502d895d770fc112.tar.gz
pw-darwin-9001ce8b2e811f82e7d91341502d895d770fc112.tar.zst
pw-darwin-9001ce8b2e811f82e7d91341502d895d770fc112.zip
The pwdb function is only used once to check the database rename it
pwdb_check and simplify it accordingly
-rw-r--r--pw/pwupd.c14
1 files changed, 4 insertions, 10 deletions
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 <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)