summaryrefslogtreecommitdiff
path: root/usr.bin/vmstat
diff options
context:
space:
mode:
authorEitan Adler <eadler@FreeBSD.org>2018-06-13 08:52:04 +0000
committerEitan Adler <eadler@FreeBSD.org>2018-06-13 08:52:04 +0000
commitbaab2cf8216f33adfad28ccb8206cf4d2e7e0e2c (patch)
tree372e96a86b5535720f5ac866454f217004918c95 /usr.bin/vmstat
parent372639f94479f21607147c522fddd2f8dd8453c3 (diff)
Notes
Diffstat (limited to 'usr.bin/vmstat')
-rw-r--r--usr.bin/vmstat/Makefile2
-rw-r--r--usr.bin/vmstat/vmstat.c15
2 files changed, 10 insertions, 7 deletions
diff --git a/usr.bin/vmstat/Makefile b/usr.bin/vmstat/Makefile
index 72734cc69c3e..bcbf4afb147b 100644
--- a/usr.bin/vmstat/Makefile
+++ b/usr.bin/vmstat/Makefile
@@ -7,8 +7,6 @@ PROG= vmstat
MAN= vmstat.8
LIBADD= devstat kvm memstat xo util
-WARNS?= 6
-
HAS_TESTS=
SUBDIR.${MK_TESTS}+= tests
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c
index 3d989df448a3..e3c6e8fa807a 100644
--- a/usr.bin/vmstat/vmstat.c
+++ b/usr.bin/vmstat/vmstat.c
@@ -218,7 +218,8 @@ main(int argc, char *argv[])
{
char *bp, *buf, *memf, *nlistf;
float f;
- int bufsize, c, len, reps, todo;
+ int bufsize, c, reps, todo;
+ size_t len;
unsigned int interval;
char errbuf[_POSIX2_LINE_MAX];
@@ -318,7 +319,8 @@ main(int argc, char *argv[])
retry_nlist:
if (kd != NULL && (c = kvm_nlist(kd, namelist)) != 0) {
if (c > 0) {
- bufsize = 0, len = 0;
+ bufsize = 0;
+ len = 0;
/*
* 'cnt' was renamed to 'vm_cnt'. If 'vm_cnt' is not
@@ -436,8 +438,11 @@ getdrivedata(char **argv)
if (isdigit(**argv))
break;
num_devices_specified++;
- specified_devices = realloc(specified_devices,
+ specified_devices = reallocf(specified_devices,
sizeof(char *) * num_devices_specified);
+ if (specified_devices == NULL) {
+ xo_errx(1, "%s", "reallocf (specified_devices)");
+ }
specified_devices[num_devices_specified - 1] = *argv;
}
dev_select = NULL;
@@ -1206,7 +1211,7 @@ cpustats(void)
total = 0;
for (state = 0; state < CPUSTATES; ++state)
total += cur.cp_time[state];
- if (total)
+ if (total > 0)
lpct = 100.0 / total;
else
lpct = 0.0;
@@ -1682,7 +1687,7 @@ kread(int nlx, void *addr, size_t size)
kreado(nlx, addr, size, 0);
}
-static void
+static void __dead2
usage(void)
{
xo_error("%s%s",