* Change type of added to bool.
* Avoid implicit conversion of pointers to booleans.
This commit is contained in:
parent
bc0657d13c
commit
9d331bb32b
@ -1,3 +1,9 @@
|
|||||||
|
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>
|
2008-05-25 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* libmisc/hushed.c: hushed returns a bool instead of int.
|
* libmisc/hushed.c: hushed returns a bool instead of int.
|
||||||
|
@ -52,7 +52,8 @@
|
|||||||
int add_groups (const char *list)
|
int add_groups (const char *list)
|
||||||
{
|
{
|
||||||
GETGROUPS_T *grouplist, *tmp;
|
GETGROUPS_T *grouplist, *tmp;
|
||||||
int i, ngroups, added;
|
int i, ngroups;
|
||||||
|
bool added;
|
||||||
char *token;
|
char *token;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
@ -79,12 +80,12 @@ int add_groups (const char *list)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
added = 0;
|
added = false;
|
||||||
for (token = strtok (buf, SEP); token; token = strtok (NULL, SEP)) {
|
for (token = strtok (buf, SEP); NULL != token; token = strtok (NULL, SEP)) {
|
||||||
struct group *grp;
|
struct group *grp;
|
||||||
|
|
||||||
grp = getgrnam (token); /* local, no need for xgetgrnam */
|
grp = getgrnam (token); /* local, no need for xgetgrnam */
|
||||||
if (!grp) {
|
if (NULL == grp) {
|
||||||
fprintf (stderr, _("Warning: unknown group %s\n"),
|
fprintf (stderr, _("Warning: unknown group %s\n"),
|
||||||
token);
|
token);
|
||||||
continue;
|
continue;
|
||||||
@ -100,13 +101,13 @@ int add_groups (const char *list)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
tmp = (gid_t *) realloc (grouplist, (ngroups + 1) * sizeof (GETGROUPS_T));
|
tmp = (gid_t *) realloc (grouplist, (ngroups + 1) * sizeof (GETGROUPS_T));
|
||||||
if (!tmp) {
|
if (NULL == tmp) {
|
||||||
free (grouplist);
|
free (grouplist);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tmp[ngroups++] = grp->gr_gid;
|
tmp[ngroups++] = grp->gr_gid;
|
||||||
grouplist = tmp;
|
grouplist = tmp;
|
||||||
added++;
|
added = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (added)
|
if (added)
|
||||||
|
Loading…
Reference in New Issue
Block a user