diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-07-12 00:02:43 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-07-12 00:02:43 +0000 |
commit | 8a2ace2a78354f2c3ed9b8228e340a3f2beeef3a (patch) | |
tree | 64c74c2aec85952910e00ad57c345106e0e4312c /usr.sbin/pw | |
parent | 52f92d8c1dbb3ab29a767846ade9b96356e76b1a (diff) | |
download | src-8a2ace2a78354f2c3ed9b8228e340a3f2beeef3a.tar.gz src-8a2ace2a78354f2c3ed9b8228e340a3f2beeef3a.zip |
Make getarg return NULL if args is NULL
Notes
Notes:
svn path=/head/; revision=285415
Diffstat (limited to 'usr.sbin/pw')
-rw-r--r-- | usr.sbin/pw/pw.c | 7 | ||||
-rw-r--r-- | usr.sbin/pw/pw_user.c | 5 |
2 files changed, 7 insertions, 5 deletions
diff --git a/usr.sbin/pw/pw.c b/usr.sbin/pw/pw.c index 3d4fcf21d5c9..532d77b1dba3 100644 --- a/usr.sbin/pw/pw.c +++ b/usr.sbin/pw/pw.c @@ -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); diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c index 315af39ed47e..16b2ac8b0756 100644 --- a/usr.sbin/pw/pw_user.c +++ b/usr.sbin/pw/pw_user.c @@ -874,11 +874,8 @@ pw_gidpolicy(struct cargs * args, char *nam, gid_t prefer) (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 *nam, gid_t prefer) 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; } |