Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/vmstat Fix error handling confusion between error an...
details: https://anonhg.NetBSD.org/src/rev/7d5881821ef9
branches: trunk
changeset: 350085:7d5881821ef9
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Wed Jan 04 01:29:18 2017 +0000
description:
Fix error handling confusion between error and errno
diffstat:
usr.bin/vmstat/vmstat.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diffs (37 lines):
diff -r c58c3cb27438 -r 7d5881821ef9 usr.bin/vmstat/vmstat.c
--- a/usr.bin/vmstat/vmstat.c Wed Jan 04 01:06:26 2017 +0000
+++ b/usr.bin/vmstat/vmstat.c Wed Jan 04 01:29:18 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.213 2017/01/04 01:06:26 pgoyette Exp $ */
+/* $NetBSD: vmstat.c,v 1.214 2017/01/04 01:29:18 pgoyette Exp $ */
/*-
* Copyright (c) 1998, 2000, 2001, 2007 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
#if 0
static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 3/1/95";
#else
-__RCSID("$NetBSD: vmstat.c,v 1.213 2017/01/04 01:06:26 pgoyette Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.214 2017/01/04 01:29:18 pgoyette Exp $");
#endif
#endif /* not lint */
@@ -2138,13 +2138,12 @@
/* retrieve names of available histories */
miblen = __arraycount(mib);
error = sysctlnametomib("kern.hist", mib, &miblen);
- if (error == ENOENT) {
- warnx("kernel history is not compiled into the kernel.");
- return;
- }
if (error != 0) {
- err(1, "nametomib failed");
- return;
+ if (errno == ENOENT) {
+ warnx("kernel history is not compiled into the kernel.");
+ return;
+ } else
+ err(EXIT_FAILURE, "nametomib failed");
}
/* get the list of nodenames below kern.hist */
Home |
Main Index |
Thread Index |
Old Index