Bug#561161: statistics.c: Better patch

Mats Erik Andersson mats.andersson at gisladisker.se
Tue Sep 20 23:47:40 UTC 2011


It seems that the desirable patching should encompass
the alterations provided below. The previously indicated
patch with origin in Red Hat, is not applicable to our
package.

Best regards,
  M E A, DM


--- net-tools-1.60/statistics.c.debian
+++ net-tools-1.60/statistics.c
@@ -330,7 +330,7 @@ int cmpentries(const void *a, const void
     return strcmp(((struct entry *) a)->title, ((struct entry *) b)->title);
 }
 
-void printval(struct tabtab *tab, char *title, int val)
+void printval(struct tabtab *tab, char *title, unsigned long long int val)
 {
     struct entry *ent = NULL, key;
     int type;
@@ -342,7 +342,7 @@ void printval(struct tabtab *tab, char *
 			  sizeof(struct entry), cmpentries);
     if (!ent) {			/* try our best */
 	if (val) 
-		printf("%*s%s: %d\n", states[state].indent, "", title, val);
+		printf("%*s%s: %llu\n", states[state].indent, "", title, val);
 	return;
     }
     type = ent->type;
@@ -452,7 +452,7 @@ int process_fd(FILE *f, int all, char *f
 	    *p = '\0';
 
 	    if (*sp != '\0' && *(tab->flag)) 	
-		printval(tab, sp, strtoul(np, &np, 10));
+		printval(tab, sp, strtoull(np, &np, 10));
 
 	    sp = p + 1;
 	}
@@ -479,12 +479,12 @@ void cpytitle(char *original, char *new)
 void process6_fd(FILE *f)
 {
    char buf1[1024],buf2[50],buf3[1024];
-   unsigned long val;
+   unsigned long long val;
    struct tabtab *tab = NULL;
    int cpflg = 0;
 
    while (fgets(buf1, sizeof buf1, f)) {
-          sscanf(buf1, "%s %lu", buf2, &val);
+          sscanf(buf1, "%s %llu", buf2, &val);
           if(!cpflg) {
              cpytitle(buf2, buf3);
              tab = newtable(snmp6tabs, buf3);





More information about the Pkg-net-tools-maintainers mailing list