[Pkg-shadow-commits] r2523 - in upstream/trunk: . libmisc

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Sun Mar 15 21:10:36 UTC 2009


Author: nekral-guest
Date: 2009-03-15 21:10:35 +0000 (Sun, 15 Mar 2009)
New Revision: 2523

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/libmisc/addgrps.c
Log:
	* libmisc/addgrps.c: Fix compilation warnings.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2009-03-14 17:46:26 UTC (rev 2522)
+++ upstream/trunk/ChangeLog	2009-03-15 21:10:35 UTC (rev 2523)
@@ -1,3 +1,7 @@
+2009-03-15  Nicolas François  <nicolas.francois at centraliens.net>
+
+	* libmisc/addgrps.c: Fix compilation warnings.
+
 2009-03-14  Nicolas François  <nicolas.francois at centraliens.net>
 
 	* man/po/Makefile.in.in: xml2po cannot exclude one entity for

Modified: upstream/trunk/libmisc/addgrps.c
===================================================================
--- upstream/trunk/libmisc/addgrps.c	2009-03-14 17:46:26 UTC (rev 2522)
+++ upstream/trunk/libmisc/addgrps.c	2009-03-15 21:10:35 UTC (rev 2523)
@@ -52,7 +52,7 @@
 int add_groups (const char *list)
 {
 	GETGROUPS_T *grouplist, *tmp;
-	unsigned int i;
+	size_t i;
 	int ngroups;
 	bool added;
 	char *token;
@@ -71,7 +71,7 @@
 			return -1;
 		}
 		ngroups = getgroups (i, grouplist);
-		if (i > ngroups) {
+		if ((-1 == ngroups) || (i > (size_t)ngroups)) {
 			break;
 		}
 		/* not enough room, so try allocating a larger buffer */
@@ -94,9 +94,9 @@
 			continue;
 		}
 
-		for (i = 0; i < ngroups && grouplist[i] != grp->gr_gid; i++);
+		for (i = 0; i < (size_t)ngroups && grouplist[i] != grp->gr_gid; i++);
 
-		if (i < ngroups) {
+		if (i < (size_t)ngroups) {
 			continue;
 		}
 
@@ -104,12 +104,13 @@
 			fputs (_("Warning: too many groups\n"), stderr);
 			break;
 		}
-		tmp = (gid_t *) realloc (grouplist, (ngroups + 1) * sizeof (GETGROUPS_T));
+		tmp = (gid_t *) realloc (grouplist, (size_t)(ngroups + 1) * sizeof (GETGROUPS_T));
 		if (NULL == tmp) {
 			free (grouplist);
 			return -1;
 		}
-		tmp[ngroups++] = grp->gr_gid;
+		tmp[ngroups] = grp->gr_gid;
+		ngroups++;
 		grouplist = tmp;
 		added = true;
 	}




More information about the Pkg-shadow-commits mailing list