Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jan 2017 08:40:54 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r312033 - stable/11/usr.sbin/rwhod
Message-ID:  <201701130840.v0D8esCO050976@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Fri Jan 13 08:40:53 2017
New Revision: 312033
URL: https://svnweb.freebsd.org/changeset/base/312033

Log:
  MFC r311709:
  
  Style(9) fixes
  
  - Sort sys/ #includes
  - Use nitems instead of hardcoding the length of `mib`

Modified:
  stable/11/usr.sbin/rwhod/rwhod.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/rwhod/rwhod.c
==============================================================================
--- stable/11/usr.sbin/rwhod/rwhod.c	Fri Jan 13 08:39:40 2017	(r312032)
+++ stable/11/usr.sbin/rwhod/rwhod.c	Fri Jan 13 08:40:53 2017	(r312033)
@@ -43,14 +43,14 @@ static char sccsid[] = "@(#)rwhod.c	8.1 
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include <sys/capsicum.h>
 #include <sys/param.h>
+#include <sys/capsicum.h>
+#include <sys/ioctl.h>
+#include <sys/procdesc.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/signal.h>
-#include <sys/ioctl.h>
 #include <sys/sysctl.h>
-#include <sys/procdesc.h>
 #include <sys/wait.h>
 
 #include <net/if.h>
@@ -548,7 +548,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);
 	}
@@ -629,11 +629,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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701130840.v0D8esCO050976>