mirror of
https://github.com/sheumann/hush.git
synced 2025-01-26 14:33:00 +00:00
iostat: add forgotted fclose(); fix default count.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
7783248eaa
commit
dcaed97e0f
@ -20,8 +20,8 @@
|
|||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
#include <sys/utsname.h> /* Need struct utsname */
|
#include <sys/utsname.h> /* Need struct utsname */
|
||||||
|
|
||||||
#define debug(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__)
|
//#define debug(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__)
|
||||||
//#define debug(fmt, ...) ((void)0)
|
#define debug(fmt, ...) ((void)0)
|
||||||
|
|
||||||
#define MAX_DEVICE_NAME 12
|
#define MAX_DEVICE_NAME 12
|
||||||
#define CURRENT 0
|
#define CURRENT 0
|
||||||
@ -402,6 +402,8 @@ static void do_disk_statistics(cputime_t itv)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dev_report(cputime_t itv)
|
static void dev_report(cputime_t itv)
|
||||||
@ -493,7 +495,7 @@ int iostat_main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int opt, dev_num;
|
int opt, dev_num;
|
||||||
unsigned interval = 0;
|
unsigned interval = 0;
|
||||||
int count = 0;
|
int count;
|
||||||
cputime_t global_uptime[2] = { 0 };
|
cputime_t global_uptime[2] = { 0 };
|
||||||
cputime_t smp_uptime[2] = { 0 };
|
cputime_t smp_uptime[2] = { 0 };
|
||||||
cputime_t itv;
|
cputime_t itv;
|
||||||
@ -537,10 +539,11 @@ int iostat_main(int argc, char **argv)
|
|||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
count = 1;
|
||||||
if (*argv) {
|
if (*argv) {
|
||||||
/* Get interval */
|
/* Get interval */
|
||||||
interval = xatoi_positive(*argv);
|
interval = xatoi_positive(*argv);
|
||||||
count = interval ? -1 : 1;
|
count = (interval != 0 ? -1 : 1);
|
||||||
argv++;
|
argv++;
|
||||||
if (*argv)
|
if (*argv)
|
||||||
/* Get count value */
|
/* Get count value */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user