diff options
-rw-r--r-- | usr.sbin/iostat/iostat.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c index b38c6dc..111d927 100644 --- a/usr.sbin/iostat/iostat.c +++ b/usr.sbin/iostat/iostat.c @@ -281,11 +281,17 @@ main(int argc, char **argv) Tflag = 1; } + /* find out how many devices we have */ + if ((num_devices = devstat_getnumdevs(kd)) < 0) + err(1, "can't get number of devices"); + /* * Figure out how many devices we should display. */ if (nflag == 0) { - if (oflag > 0) { + if (xflag > 0) + maxshowdevs = num_devices; + else if (oflag > 0) { if ((dflag > 0) && (Cflag == 0) && (Tflag == 0)) maxshowdevs = 5; else if ((dflag > 0) && (Tflag > 0) && (Cflag == 0)) @@ -300,10 +306,6 @@ main(int argc, char **argv) } } - /* find out how many devices we have */ - if ((num_devices = devstat_getnumdevs(kd)) < 0) - err(1, "can't get number of devices"); - cur.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo)); if (cur.dinfo == NULL) err(1, "malloc failed"); |