* libmisc/addgrps.c: Avoid implicit conversion of pointers to
booleans. * libmisc/addgrps.c: Add brackets.
This commit is contained in:
parent
43e4d608ae
commit
6099bda088
@ -1,7 +1,13 @@
|
||||
2008-06-13 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* libmisc/addgrps.c: Avoid implicit conversion of pointers to
|
||||
booleans.
|
||||
* libmisc/addgrps.c: Add brackets.
|
||||
|
||||
2008-06-13 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* libmisc/utmp.c: Avoid implicit conversion of pointers to
|
||||
booleans
|
||||
booleans.
|
||||
|
||||
2008-06-13 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
|
@ -66,11 +66,13 @@ int add_groups (const char *list)
|
||||
i = 16;
|
||||
for (;;) {
|
||||
grouplist = (gid_t *) malloc (i * sizeof (GETGROUPS_T));
|
||||
if (!grouplist)
|
||||
if (NULL == grouplist) {
|
||||
return -1;
|
||||
}
|
||||
ngroups = getgroups (i, grouplist);
|
||||
if (i > ngroups)
|
||||
if (i > ngroups) {
|
||||
break;
|
||||
}
|
||||
/* not enough room, so try allocating a larger buffer */
|
||||
free (grouplist);
|
||||
i *= 2;
|
||||
@ -93,8 +95,9 @@ int add_groups (const char *list)
|
||||
|
||||
for (i = 0; i < ngroups && grouplist[i] != grp->gr_gid; i++);
|
||||
|
||||
if (i < ngroups)
|
||||
if (i < ngroups) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ngroups >= sysconf (_SC_NGROUPS_MAX)) {
|
||||
fputs (_("Warning: too many groups\n"), stderr);
|
||||
@ -110,8 +113,9 @@ int add_groups (const char *list)
|
||||
added = true;
|
||||
}
|
||||
|
||||
if (added)
|
||||
if (added) {
|
||||
return setgroups (ngroups, grouplist);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user