summaryrefslogtreecommitdiffstats
path: root/pw
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-07-12 00:02:43 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-07-12 00:02:43 +0000
commit5c8793faf0c3ceee6ca534d0f69b417a3759f7af (patch)
treecba1ad072930f098dd9524c5359a684cf0afbeb4 /pw
parent53d815d2b67ba1daf3d088e6049c75e9134228d2 (diff)
downloadpw-darwin-5c8793faf0c3ceee6ca534d0f69b417a3759f7af.tar.gz
pw-darwin-5c8793faf0c3ceee6ca534d0f69b417a3759f7af.tar.zst
pw-darwin-5c8793faf0c3ceee6ca534d0f69b417a3759f7af.zip
Make getarg return NULL if args is NULL
Diffstat (limited to 'pw')
-rw-r--r--pw/pw.c7
-rw-r--r--pw/pw_user.c5
2 files changed, 7 insertions, 5 deletions
diff --git a/pw/pw.c b/pw/pw.c
index 3d4fcf2..532d77b 100644
--- a/pw/pw.c
+++ b/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/pw/pw_user.c b/pw/pw_user.c
index 315af39..16b2ac8 100644
--- a/pw/pw_user.c
+++ b/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;
}