Date: Sun, 10 May 2015 09:23:03 +0000 (UTC) From: Baptiste Daroussin <bapt@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282713 - head/usr.sbin/pw Message-ID: <201505100923.t4A9N3cT011654@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bapt Date: Sun May 10 09:23:03 2015 New Revision: 282713 URL: https://svnweb.freebsd.org/changeset/base/282713 Log: The pwdb function is only used once to check the database rename it pwdb_check and simplify it accordingly Modified: head/usr.sbin/pw/pwupd.c Modified: head/usr.sbin/pw/pwupd.c ============================================================================== --- head/usr.sbin/pw/pwupd.c Sun May 10 09:11:12 2015 (r282712) +++ head/usr.sbin/pw/pwupd.c Sun May 10 09:23:03 2015 (r282713) @@ -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 cons 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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505100923.t4A9N3cT011654>