summaryrefslogtreecommitdiff
path: root/usr.sbin/iostat/iostat.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2007-02-06 20:29:40 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2007-02-06 20:29:40 +0000
commit8d56a4caf9394185ab0b83a4f6ebf4a76a9504b5 (patch)
tree8a3dc6a8ca9146123b60325488bcbfddc1e9a865 /usr.sbin/iostat/iostat.c
parent1300fd67f384aad66d54301c7cf094257c15973e (diff)
downloadsrc-test2-8d56a4caf9394185ab0b83a4f6ebf4a76a9504b5.tar.gz
src-test2-8d56a4caf9394185ab0b83a4f6ebf4a76a9504b5.zip
Notes
Diffstat (limited to 'usr.sbin/iostat/iostat.c')
-rw-r--r--usr.sbin/iostat/iostat.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c
index 01c8c6963801..7446780e4309 100644
--- a/usr.sbin/iostat/iostat.c
+++ b/usr.sbin/iostat/iostat.c
@@ -823,15 +823,16 @@ readvar(kvm_t *kd, const char *name, int nlid, void *ptr, size_t len)
if (kd != NULL) {
ssize_t nbytes;
- nbytes = kvm_read(kd, nlid, ptr, len);
+ nbytes = kvm_read(kd, namelist[nlid].n_value, ptr, len);
- if (nbytes == 0) {
- warnx("kvm_read(%s): %s", name, kvm_geterr(kd));
+ if (nbytes < 0) {
+ warnx("kvm_read(%s): %s", namelist[nlid].n_name,
+ kvm_geterr(kd));
return (1);
}
if (nbytes != len) {
- warnx("kvm_read(%s): expected %lu bytes, got %ld bytes",
- name, (unsigned long)len, (long)nbytes);
+ warnx("kvm_read(%s): expected %zu bytes, got %zd bytes",
+ namelist[nlid].n_name, len, nbytes);
return (1);
}
} else {