iproute/iproute2-3.10.0-lnstat-interval.patch
2013-08-30 11:10:40 +02:00

30 lines
763 B
Diff

diff --git a/misc/lnstat.c b/misc/lnstat.c
index dca10ad..2889e5e 100644
--- a/misc/lnstat.c
+++ b/misc/lnstat.c
@@ -226,7 +226,7 @@ int main(int argc, char **argv)
MODE_NORMAL,
} mode = MODE_NORMAL;
- unsigned long count = 1;
+ unsigned long count = 0;
static struct field_params fp;
int num_req_files = 0;
char *req_files[LNSTAT_MAX_FILES];
@@ -336,13 +336,14 @@ int main(int argc, char **argv)
if (interval < 1 )
interval=1;
- for (i = 0; i < count; i++) {
+ for (i = 0; !count || i < count; ) {
if ((hdr > 1 && (! (i % 20))) || (hdr == 1 && i == 0))
print_hdr(stdout, header);
lnstat_update(lnstat_files);
print_line(stdout, lnstat_files, &fp);
fflush(stdout);
sleep(interval);
+ if (count) ++i;
}
}