]> granicus.if.org Git - shadow/commitdiff
* Change type of added to bool.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 25 May 2008 22:03:09 +0000 (22:03 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 25 May 2008 22:03:09 +0000 (22:03 +0000)
* Avoid implicit conversion of pointers to booleans.

ChangeLog
libmisc/addgrps.c

index 94ffeee8e6782b7d07fbda23ff1bbb1ed4080380..dcf3de4e4b22fc35b7d149c0d1fa8c4dc6462a60 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * libmisc/hushed.c: hushed returns a bool instead of int.
index 86d1927830ef0d433e749c337a6f1e9c2bee7202..ee0f64399e94df75c9808b0b16a0a247fab1a27f 100644 (file)
@@ -52,7 +52,8 @@
 int add_groups (const char *list)
 {
        GETGROUPS_T *grouplist, *tmp;
-       int i, ngroups, added;
+       int i, ngroups;
+       bool added;
        char *token;
        char buf[1024];
 
@@ -79,12 +80,12 @@ int add_groups (const char *list)
                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;
@@ -100,13 +101,13 @@ int add_groups (const char *list)
                        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)