diff options
author | 2014-03-29 08:39:53 +0000 | |
---|---|---|
committer | 2014-03-29 08:39:53 +0000 | |
commit | 2a57fcaeb75e2f21800558ca79a3aee8e85c9ca9 (patch) | |
tree | 5cab5cd106f6d9a3676c765e78762ba203646723 /pw/pw_group.c | |
parent | 16ea9a8a1a32ede8bc7dc6b3788feafd64a23b98 (diff) | |
parent | ae9996e5308cbc61d18b0262c89637b8c6981572 (diff) | |
download | pw-darwin-2a57fcaeb75e2f21800558ca79a3aee8e85c9ca9.tar.gz pw-darwin-2a57fcaeb75e2f21800558ca79a3aee8e85c9ca9.tar.zst pw-darwin-2a57fcaeb75e2f21800558ca79a3aee8e85c9ca9.zip |
Merge head up to r263906.
Diffstat (limited to 'pw/pw_group.c')
-rw-r--r-- | pw/pw_group.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/pw/pw_group.c b/pw/pw_group.c index 3259412..391e477 100644 --- a/pw/pw_group.c +++ b/pw/pw_group.c @@ -227,10 +227,12 @@ pw_group(struct userconf * cnf, int mode, struct cargs * args) else if (arg->ch == 'm') { int k = 0; - while (grp->gr_mem[k] != NULL) { - if (extendarray(&members, &grmembers, i + 2) != -1) - members[i++] = grp->gr_mem[k]; - k++; + if (grp->gr_mem != NULL) { + while (grp->gr_mem[k] != NULL) { + if (extendarray(&members, &grmembers, i + 2) != -1) + members[i++] = grp->gr_mem[k]; + k++; + } } } @@ -311,6 +313,9 @@ delete_members(char ***members, int *grmembers, int *i, struct carg *arg, int k; struct passwd *pwd; + if (grp->gr_mem == NULL) + return; + k = 0; while (grp->gr_mem[k] != NULL) { matchFound = false; @@ -415,8 +420,10 @@ print_group(struct group * grp, int pretty) printf("Group Name: %-15s #%lu\n" " Members: ", grp->gr_name, (long) grp->gr_gid); - for (i = 0; grp->gr_mem[i]; i++) - printf("%s%s", i ? "," : "", grp->gr_mem[i]); + if (grp->gr_mem != NULL) { + for (i = 0; grp->gr_mem[i]; i++) + printf("%s%s", i ? "," : "", grp->gr_mem[i]); + } fputs("\n\n", stdout); } return EXIT_SUCCESS; |