From owner-svn-src-stable-10@freebsd.org Fri Jan 13 08:41:00 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25D9DCA5AD8; Fri, 13 Jan 2017 08:41:00 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E7300177A; Fri, 13 Jan 2017 08:40:59 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0D8exaO051650; Fri, 13 Jan 2017 08:40:59 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0D8extn051649; Fri, 13 Jan 2017 08:40:59 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201701130840.v0D8extn051649@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 13 Jan 2017 08:40:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r312034 - stable/10/usr.sbin/rwhod X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2017 08:41:00 -0000 Author: ngie Date: Fri Jan 13 08:40:58 2017 New Revision: 312034 URL: https://svnweb.freebsd.org/changeset/base/312034 Log: MFC r311709: Style(9) fixes - Sort sys/ #includes - Use nitems instead of hardcoding the length of `mib` Modified: stable/10/usr.sbin/rwhod/rwhod.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/rwhod/rwhod.c ============================================================================== --- stable/10/usr.sbin/rwhod/rwhod.c Fri Jan 13 08:40:53 2017 (r312033) +++ stable/10/usr.sbin/rwhod/rwhod.c Fri Jan 13 08:40:58 2017 (r312034) @@ -43,14 +43,14 @@ static char sccsid[] = "@(#)rwhod.c 8.1 #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;