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 *
|
struct carg *
|
||||||
getarg(struct cargs * _args, int ch)
|
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)
|
while (c != NULL && c->ch != ch)
|
||||||
c = LIST_NEXT(c, list);
|
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)) {
|
(grp->gr_mem == NULL || grp->gr_mem[0] == NULL)) {
|
||||||
gid = grp->gr_gid; /* Already created? Use it anyway... */
|
gid = grp->gr_gid; /* Already created? Use it anyway... */
|
||||||
} else {
|
} else {
|
||||||
struct cargs grpargs;
|
|
||||||
gid_t grid = -1;
|
gid_t grid = -1;
|
||||||
|
|
||||||
LIST_INIT(&grpargs);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We need to auto-create a group with the user's name. We
|
* We need to auto-create a group with the user's name. We
|
||||||
* can send all the appropriate output to our sister routine
|
* 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) {
|
if (conf.dryrun) {
|
||||||
gid = pw_groupnext(cnf, true);
|
gid = pw_groupnext(cnf, true);
|
||||||
} else {
|
} else {
|
||||||
pw_group(M_ADD, nam, grid, &grpargs);
|
pw_group(M_ADD, nam, grid, NULL);
|
||||||
if ((grp = GETGRNAM(nam)) != NULL)
|
if ((grp = GETGRNAM(nam)) != NULL)
|
||||||
gid = grp->gr_gid;
|
gid = grp->gr_gid;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user