]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
lnstat: run indefinitely by default
authorPavel Šimerda <psimerda@redhat.com>
Mon, 13 Apr 2015 14:01:01 +0000 (16:01 +0200)
committerStephen Hemminger <shemming@brocade.com>
Mon, 20 Apr 2015 16:58:11 +0000 (09:58 -0700)
See also:

 * https://bugzilla.redhat.com/show_bug.cgi?id=977845

Signed-off-by: Pavel Šimerda <psimerda@redhat.com>
misc/lnstat.c

index 32b5cbe579162589b3c3aa708c250529b7aedde3..41e76fcfa82933f064d6d5dcd2def1e34fc8d45a 100644 (file)
@@ -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;
        }