From f5f1a6c5836a405381fb9d4be74d5ddf98404db1 Mon Sep 17 00:00:00 2001 From: "osdl.net!shemminger" Date: Fri, 18 Mar 2005 19:40:19 +0000 Subject: [PATCH] Fix sum of first field (entries). (Logical change 1.172) --- misc/lnstat_util.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/misc/lnstat_util.c b/misc/lnstat_util.c index f99e939e..4127100d 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; }