iproute/iproute2-3.19.0-lnstat-interval.patch
2015-04-10 12:36:06 +02:00

55 lines
1.4 KiB
Diff

From f016b9a352182df5856412c4e046d2a23424297f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20=C5=A0imerda?= <psimerda@redhat.com>
Date: Fri, 13 Mar 2015 13:17:02 +0100
Subject: [PATCH 7/7] lnstat: run indefinitely by default
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
See also:
* https://bugzilla.redhat.com/show_bug.cgi?id=977845
Signed-Off-By: Pavel Šimerda <psimerda@redhat.com>
---
misc/lnstat.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/misc/lnstat.c b/misc/lnstat.c
index e105b70..0385cbb 100644
--- a/misc/lnstat.c
+++ b/misc/lnstat.c
@@ -249,7 +249,7 @@ int main(int argc, char **argv)
MODE_JSON,
MODE_NORMAL,
} mode = MODE_NORMAL;
- unsigned long count = 1;
+ unsigned long count = 0;
struct table_hdr *header;
static struct field_params fp;
int num_req_files = 0;
@@ -362,7 +362,7 @@ int main(int argc, char **argv)
if (interval < 1 )
interval = 1;
- for (i = 0; i < count; i++) {
+ for (i = 0; i < count || !count; ) {
lnstat_update(lnstat_files);
if (mode == MODE_JSON)
print_json(stdout, lnstat_files, &fp);
@@ -373,8 +373,10 @@ int main(int argc, char **argv)
print_line(stdout, lnstat_files, &fp);
}
fflush(stdout);
- if (i < count - 1)
+ if (i < count - 1 || !count)
sleep(interval);
+ if (count)
+ ++i;
}
break;
}
--
2.0.5