]> granicus.if.org Git - shadow/commitdiff
* libmisc/addgrps.c: Avoid implicit conversion of pointers to
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Fri, 13 Jun 2008 18:19:34 +0000 (18:19 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Fri, 13 Jun 2008 18:19:34 +0000 (18:19 +0000)
booleans.
* libmisc/addgrps.c: Add brackets.

ChangeLog
libmisc/addgrps.c

index cd0e15998eeb884b55bc9ab9da1f0ff3bb098ffc..a540359d553cff5548b904d3c93ab39227bbdcaf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
index ee0f64399e94df75c9808b0b16a0a247fab1a27f..0c75ee827db444cd142df8a1ef5295530ae8046d 100644 (file)
@@ -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;
 }