]> git.ipfire.org Git - ipfire-3.x.git/blob - iproute2/patches/iproute2-3.12.0-lnstat-interval.patch
b20f079480b39c72e7aba9800e482b3d16fba7ef
[ipfire-3.x.git] / iproute2 / patches / iproute2-3.12.0-lnstat-interval.patch
1 diff --git a/misc/lnstat.c b/misc/lnstat.c
2 index 8608cfa..8e8b1ba 100644
3 --- a/misc/lnstat.c
4 +++ b/misc/lnstat.c
5 @@ -253,7 +253,7 @@ int main(int argc, char **argv)
6 MODE_JSON,
7 MODE_NORMAL,
8 } mode = MODE_NORMAL;
9 - unsigned long count = 1;
10 + unsigned long count = 0;
11 struct table_hdr *header;
12 static struct field_params fp;
13 int num_req_files = 0;
14 @@ -366,7 +366,7 @@ int main(int argc, char **argv)
15 if (interval < 1 )
16 interval = 1;
17
18 - for (i = 0; i < count; i++) {
19 + for (i = 0; i < count || !count; ) {
20 lnstat_update(lnstat_files);
21 if (mode == MODE_JSON)
22 print_json(stdout, lnstat_files, &fp);
23 @@ -377,8 +377,10 @@ int main(int argc, char **argv)
24 print_line(stdout, lnstat_files, &fp);
25 }
26 fflush(stdout);
27 - if (i < count - 1)
28 + if (i < count - 1 || !count)
29 sleep(interval);
30 + if (count)
31 + ++i;
32 }
33 break;
34 }