svn commit: r285415 - head/usr.sbin/pw

Baptiste Daroussin bapt at FreeBSD.org
Sun Jul 12 00:02:45 UTC 2015


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;
 		}


More information about the svn-src-all mailing list