Commit 6caab4ce authored by Arun Raghavan's avatar Arun Raghavan
Browse files

vmstat: Fix -n flag

The loop condition for the number of iterations basically caused the
argument to -n to be ignored. This fixes the condition appropriately.
parent 2177c79b
......@@ -75,7 +75,7 @@ int vmstat_main(int argc, char *argv[]) {
int toggle, count;
int i;
iterations = 0;
iterations = -1;
delay = 1;
header_interval = 20;
......@@ -119,7 +119,7 @@ int vmstat_main(int argc, char *argv[]) {
if (!header_interval)
print_header();
read_state(&s[1 - toggle]);
while ((iterations == 0) || (iterations-- > 0)) {
while ((iterations < 0) || (iterations-- > 0)) {
sleep(delay);
read_state(&s[toggle]);
if (header_interval) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment