INN commit: trunk/backends (actsync.c)

INN Commit Russ_Allbery at isc.org
Thu Aug 9 12:35:25 UTC 2007


    Date: Thursday, August 9, 2007 @ 05:35:24
  Author: iulius
Revision: 7638

Use asprintf instead of snprintf twice.
Fix the count of ignored groups.

Modified:
  trunk/backends/actsync.c

-----------+
 actsync.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

Modified: actsync.c
===================================================================
--- actsync.c	2007-08-08 17:35:09 UTC (rev 7637)
+++ actsync.c	2007-08-09 12:35:24 UTC (rev 7638)
@@ -1812,7 +1812,7 @@
     int change;		/* number of groups changed */
     int remove;		/* number of groups removed */
     int no_new_dir;	/* number of new groups with missing/empty dirs */
-    int new_dir;	/* number of new groupsm, non-empty dir no water chg */
+    int new_dir;	/* number of new groups, non-empty dir no water chg */
     int water_change;	/* number of new groups where hi&low water changed */
     int work;		/* adds + changes + removals */
     int same;		/* the number of groups the same */
@@ -2008,7 +2008,8 @@
 	     * non-error, non-removed groups from host1
 	     */
 	    if (grp[i].output == 0) {
-		if (grp[i].hostid == HOSTID1) {
+                /* Ignored groups should only be counted once. */
+		if (!rm_cycle && grp[i].hostid == HOSTID1) {
 		    ++ignore;
 		}
 		continue;
@@ -2540,7 +2541,6 @@
     int status;			/* wait status */
     int exitval;		/* exit status of the child */
     char *w_string = NULL;     /* will contain "-t "+w_flag */
-    int w_size;                /* size of w_string */
     char *p;
 
     /* firewall */
@@ -2623,13 +2623,8 @@
 
 	/* exec the ctlinnd command */
 	p = concatpath(innconf->pathbin, INN_PATH_CTLINND);
+	asprintf(&w_string, "-t %d", w_flag);
 
-    /* prepare the w_string parameter for ctlinnd time out
-       (+3 for '-t ' and +1 for '\0') */
-    w_size = snprintf(w_string, 0, "%d", w_flag) + 4;
-    w_string = xmalloc(w_size);
-    snprintf(w_string, w_size, "-t %d", w_flag);
-
 	if (type == NULL) {
 	    execl(p,
 		  CTLINND_NAME, w_string, cmd, grp, (char *) 0);



More information about the inn-committers mailing list