Make getarg return NULL if args is NULL
This commit is contained in:
parent
52f92d8c1d
commit
8a2ace2a78
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user