diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c --- a/usr.bin/vmstat/vmstat.c +++ b/usr.bin/vmstat/vmstat.c @@ -64,7 +64,6 @@ #include #include -#include #include #include #include @@ -348,8 +347,9 @@ xo_error("undefined symbols:\n", buf); } else xo_warnx("kvm_nlist: %s", kvm_geterr(kd)); - xo_finish(); - exit(1); + if (xo_finish() < 0) + xo_err(EXIT_FAILURE, "stdout"); + exit(EXIT_FAILURE); } nlist_ok: if (kd && Pflag) @@ -395,8 +395,9 @@ dointr(interval, reps); if (todo & VMSTAT) dovmstat(interval, reps); - xo_finish(); - exit(0); + if (xo_finish() < 0) + xo_err(EXIT_FAILURE, "stdout"); + exit(EXIT_SUCCESS); } static int @@ -1678,6 +1679,7 @@ xo_error("%s%s", "usage: vmstat [-afHhimoPsz] [-M core [-N system]] [-c count] [-n devs]\n", " [-p type,if,pass] [-w wait] [disks] [wait [count]]\n"); - xo_finish(); - exit(1); + if (xo_finish() < 0) + xo_err(EXIT_FAILURE, "stdout"); + exit(EXIT_FAILURE); }