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.
  • Loading branch information...
1 parent 2177c79 commit 6caab4ce959478b96c40955236e13e80ef83145d @ford-prefect ford-prefect committed Jan 10, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 toolbox/vmstat.c
View
4 toolbox/vmstat.c
@@ -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) {

0 comments on commit 6caab4c

Please sign in to comment.