From 973cfee7ecfa65578dd6c5bf5d8534100012d68d Mon Sep 17 00:00:00 2001 From: ngie Date: Fri, 13 Jan 2017 08:40:58 +0000 Subject: [PATCH] MFC r311709: Style(9) fixes - Sort sys/ #includes - Use nitems instead of hardcoding the length of `mib` git-svn-id: svn://svn.freebsd.org/base/stable/10@312034 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- usr.sbin/rwhod/rwhod.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/usr.sbin/rwhod/rwhod.c b/usr.sbin/rwhod/rwhod.c index ff7a60a33..df61c55c0 100644 --- a/usr.sbin/rwhod/rwhod.c +++ b/usr.sbin/rwhod/rwhod.c @@ -43,14 +43,14 @@ static char sccsid[] = "@(#)rwhod.c 8.1 (Berkeley) 6/6/93"; #include __FBSDID("$FreeBSD$"); -#include #include +#include +#include +#include #include #include #include -#include #include -#include #include #include @@ -549,7 +549,7 @@ getboottime(int signo __unused) mib[0] = CTL_KERN; mib[1] = KERN_BOOTTIME; size = sizeof(tm); - if (sysctl(mib, 2, &tm, &size, NULL, 0) == -1) { + if (sysctl(mib, nitems(mib), &tm, &size, NULL, 0) == -1) { syslog(LOG_ERR, "cannot get boottime: %m"); exit(1); } @@ -630,11 +630,11 @@ configure(int so) mib[3] = AF_INET; mib[4] = NET_RT_IFLIST; mib[5] = 0; - if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) + if (sysctl(mib, nitems(mib), NULL, &needed, NULL, 0) < 0) quit("route-sysctl-estimate"); if ((buf = malloc(needed)) == NULL) quit("malloc"); - if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) + if (sysctl(mib, nitems(mib), buf, &needed, NULL, 0) < 0) quit("actual retrieval of interface table"); lim = buf + needed; -- 2.45.0