From owner-svn-src-head@freebsd.org Sun Jul 12 00:02:45 2015 Return-Path: Delivered-To: svn-src-head@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 67E9F999661; Sun, 12 Jul 2015 00:02:45 +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 543E319ED; Sun, 12 Jul 2015 00:02:45 +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 t6C02jHc001158; Sun, 12 Jul 2015 00:02:45 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6C02i8i001155; Sun, 12 Jul 2015 00:02:44 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201507120002.t6C02i8i001155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 12 Jul 2015 00:02:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285415 - 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-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jul 2015 00:02:45 -0000 Author: bapt Date: Sun Jul 12 00:02:43 2015 New Revision: 285415 URL: https://svnweb.freebsd.org/changeset/base/285415 Log: Make getarg return NULL if args is NULL Modified: head/usr.sbin/pw/pw.c head/usr.sbin/pw/pw_user.c Modified: head/usr.sbin/pw/pw.c ============================================================================== --- head/usr.sbin/pw/pw.c Sat Jul 11 23:56:55 2015 (r285414) +++ head/usr.sbin/pw/pw.c Sun Jul 12 00:02:43 2015 (r285415) @@ -582,7 +582,12 @@ cmdhelp(int mode, int which) struct carg * getarg(struct cargs * _args, int ch) { - struct carg *c = LIST_FIRST(_args); + struct carg *c; + + if (_args == NULL) + return (NULL); + + c = LIST_FIRST(_args); while (c != NULL && c->ch != ch) c = LIST_NEXT(c, list); Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Sat Jul 11 23:56:55 2015 (r285414) +++ head/usr.sbin/pw/pw_user.c Sun Jul 12 00:02:43 2015 (r285415) @@ -874,11 +874,8 @@ pw_gidpolicy(struct cargs * args, char * (grp->gr_mem == NULL || grp->gr_mem[0] == NULL)) { gid = grp->gr_gid; /* Already created? Use it anyway... */ } else { - struct cargs grpargs; gid_t grid = -1; - LIST_INIT(&grpargs); - /* * We need to auto-create a group with the user's name. We * can send all the appropriate output to our sister routine @@ -893,7 +890,7 @@ pw_gidpolicy(struct cargs * args, char * if (conf.dryrun) { gid = pw_groupnext(cnf, true); } else { - pw_group(M_ADD, nam, grid, &grpargs); + pw_group(M_ADD, nam, grid, NULL); if ((grp = GETGRNAM(nam)) != NULL) gid = grp->gr_gid; }