diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-08-12 15:36:34 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-08-12 15:36:34 +0200 |
commit | dcaed97e0f44d0cd285fb590ec6ec80d0d73e738 (patch) | |
tree | dac87aa404d65f4354fa153e7732a44d8f48b084 | |
parent | 7783248eaac715b813f0635b06cc140ea99bb4d9 (diff) | |
download | busybox-w32-dcaed97e0f44d0cd285fb590ec6ec80d0d73e738.tar.gz busybox-w32-dcaed97e0f44d0cd285fb590ec6ec80d0d73e738.tar.bz2 busybox-w32-dcaed97e0f44d0cd285fb590ec6ec80d0d73e738.zip |
iostat: add forgotted fclose(); fix default count.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | procps/iostat.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/procps/iostat.c b/procps/iostat.c index 8641c2391..76c5353cc 100644 --- a/procps/iostat.c +++ b/procps/iostat.c | |||
@@ -20,8 +20,8 @@ | |||
20 | #include "libbb.h" | 20 | #include "libbb.h" |
21 | #include <sys/utsname.h> /* Need struct utsname */ | 21 | #include <sys/utsname.h> /* Need struct utsname */ |
22 | 22 | ||
23 | #define debug(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__) | 23 | //#define debug(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__) |
24 | //#define debug(fmt, ...) ((void)0) | 24 | #define debug(fmt, ...) ((void)0) |
25 | 25 | ||
26 | #define MAX_DEVICE_NAME 12 | 26 | #define MAX_DEVICE_NAME 12 |
27 | #define CURRENT 0 | 27 | #define CURRENT 0 |
@@ -402,6 +402,8 @@ static void do_disk_statistics(cputime_t itv) | |||
402 | continue; | 402 | continue; |
403 | } | 403 | } |
404 | } | 404 | } |
405 | |||
406 | fclose(fp); | ||
405 | } | 407 | } |
406 | 408 | ||
407 | static void dev_report(cputime_t itv) | 409 | static void dev_report(cputime_t itv) |
@@ -493,7 +495,7 @@ int iostat_main(int argc, char **argv) | |||
493 | { | 495 | { |
494 | int opt, dev_num; | 496 | int opt, dev_num; |
495 | unsigned interval = 0; | 497 | unsigned interval = 0; |
496 | int count = 0; | 498 | int count; |
497 | cputime_t global_uptime[2] = { 0 }; | 499 | cputime_t global_uptime[2] = { 0 }; |
498 | cputime_t smp_uptime[2] = { 0 }; | 500 | cputime_t smp_uptime[2] = { 0 }; |
499 | cputime_t itv; | 501 | cputime_t itv; |
@@ -537,10 +539,11 @@ int iostat_main(int argc, char **argv) | |||
537 | argv++; | 539 | argv++; |
538 | } | 540 | } |
539 | 541 | ||
542 | count = 1; | ||
540 | if (*argv) { | 543 | if (*argv) { |
541 | /* Get interval */ | 544 | /* Get interval */ |
542 | interval = xatoi_positive(*argv); | 545 | interval = xatoi_positive(*argv); |
543 | count = interval ? -1 : 1; | 546 | count = (interval != 0 ? -1 : 1); |
544 | argv++; | 547 | argv++; |
545 | if (*argv) | 548 | if (*argv) |
546 | /* Get count value */ | 549 | /* Get count value */ |