From owner-svn-src-all@freebsd.org Sat Jul 11 21:09:52 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B3AE99769C; Sat, 11 Jul 2015 21:09:52 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A785E48; Sat, 11 Jul 2015 21:09:52 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6BL9qRv013539; Sat, 11 Jul 2015 21:09:52 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6BL9pGO013533; Sat, 11 Jul 2015 21:09:51 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201507112109.t6BL9pGO013533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 11 Jul 2015 21:09:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285408 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Jul 2015 21:09:52 -0000 Author: bapt Date: Sat Jul 11 21:09:50 2015 New Revision: 285408 URL: https://svnweb.freebsd.org/changeset/base/285408 Log: check the gecos format early: at the moment the -c option is parsed Modified: head/usr.sbin/pw/pw.c head/usr.sbin/pw/pw_user.c head/usr.sbin/pw/pwupd.h Modified: head/usr.sbin/pw/pw.c ============================================================================== --- head/usr.sbin/pw/pw.c Sat Jul 11 21:09:43 2015 (r285407) +++ head/usr.sbin/pw/pw.c Sat Jul 11 21:09:50 2015 (r285408) @@ -254,6 +254,9 @@ main(int argc, char *argv[]) case 'a': conf.all = true; break; + case 'c': + conf.gecos = pw_checkname(optarg, 1); + break; case 'g': if (which == 0) { /* for user* */ addarg(&arglist, 'g', optarg); Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Sat Jul 11 21:09:43 2015 (r285407) +++ head/usr.sbin/pw/pw_user.c Sat Jul 11 21:09:50 2015 (r285408) @@ -650,10 +650,9 @@ pw_user(int mode, char *name, long id, s /* * Shared add/edit code */ - if ((arg = getarg(args, 'c')) != NULL) { - char *gecos = pw_checkname(arg->val, 1); - if (strcmp(pwd->pw_gecos, gecos) != 0) { - pwd->pw_gecos = gecos; + if (conf.gecos != NULL) { + if (strcmp(pwd->pw_gecos, conf.gecos) != 0) { + pwd->pw_gecos = conf.gecos; edited = 1; } } Modified: head/usr.sbin/pw/pwupd.h ============================================================================== --- head/usr.sbin/pw/pwupd.h Sat Jul 11 21:09:43 2015 (r285407) +++ head/usr.sbin/pw/pwupd.h Sat Jul 11 21:09:50 2015 (r285408) @@ -85,6 +85,7 @@ struct pwconf { char etcpath[MAXPATHLEN]; char *newname; char *config; + char *gecos; int fd; int which; bool quiet;