X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=misc%2Flnstat_util.c;h=59c5e9648adb30ebfc090a060e4a0db45bff9fac;hb=b4a5a91c5a4ca186690479ddc0fff26644c98c93;hp=6ff3779a8dd2ee2b082e978bcffc7e10f4fd3bf4;hpb=143d7e99faac73b7f2947e37df31a75738eeadde;p=iproute2.git diff --git a/misc/lnstat_util.c b/misc/lnstat_util.c index 6ff3779..59c5e96 100644 --- a/misc/lnstat_util.c +++ b/misc/lnstat_util.c @@ -52,8 +52,13 @@ static int scan_lines(struct lnstat_file *lf, int i) fgets(buf, sizeof(buf)-1, lf->fp); gettimeofday(&lf->last_read, NULL); - for (j = 0; j < lf->num_fields; j++) - lf->fields[j].values[i] = strtoul(ptr, &ptr, 16); + for (j = 0; j < lf->num_fields; j++) { + unsigned long f = strtoul(ptr, &ptr, 16); + if (j == 0) + lf->fields[j].values[i] = f; + else + lf->fields[j].values[i] += f; + } } return num_lines; }