+2008-05-25 Nicolas François <nicolas.francois@centraliens.net>
+
+ * libmisc/addgrps.c: Change type of added to bool.
+ * libmisc/addgrps.c: Avoid implicit conversion of pointers to
+ booleans.
+
2008-05-25 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/hushed.c: hushed returns a bool instead of int.
int add_groups (const char *list)
{
GETGROUPS_T *grouplist, *tmp;
- int i, ngroups, added;
+ int i, ngroups;
+ bool added;
char *token;
char buf[1024];
return -1;
}
- added = 0;
- for (token = strtok (buf, SEP); token; token = strtok (NULL, SEP)) {
+ added = false;
+ for (token = strtok (buf, SEP); NULL != token; token = strtok (NULL, SEP)) {
struct group *grp;
grp = getgrnam (token); /* local, no need for xgetgrnam */
- if (!grp) {
+ if (NULL == grp) {
fprintf (stderr, _("Warning: unknown group %s\n"),
token);
continue;
break;
}
tmp = (gid_t *) realloc (grouplist, (ngroups + 1) * sizeof (GETGROUPS_T));
- if (!tmp) {
+ if (NULL == tmp) {
free (grouplist);
return -1;
}
tmp[ngroups++] = grp->gr_gid;
grouplist = tmp;
- added++;
+ added = true;
}
if (added)