Date: Mon, 9 Jan 2017 01:05:44 +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: r311719 - stable/11/usr.sbin/bsnmpd/modules/snmp_hostres Message-ID: <201701090105.v0915i4d085170@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Mon Jan 9 01:05:44 2017 New Revision: 311719 URL: https://svnweb.freebsd.org/changeset/base/311719 Log: MFC r311393: OS_getSystemUptime: use nitems for calculating the number of elements in a sysctl mib instead of hardcoding the number 2 Modified: stable/11/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c ============================================================================== --- stable/11/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c Mon Jan 9 01:05:02 2017 (r311718) +++ stable/11/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c Mon Jan 9 01:05:44 2017 (r311719) @@ -33,7 +33,7 @@ * Host Resources MIB scalars implementation for SNMPd. */ -#include <sys/types.h> +#include <sys/param.h> #include <sys/sysctl.h> #include <pwd.h> @@ -85,7 +85,7 @@ OS_getSystemUptime(uint32_t *ut) int mib[2] = { CTL_KERN, KERN_BOOTTIME }; size_t len = sizeof(kernel_boot_timestamp); - if (sysctl(mib, 2, &kernel_boot_timestamp, + if (sysctl(mib, nitems(mib), &kernel_boot_timestamp, &len, NULL, 0) == -1) { syslog(LOG_ERR, "sysctl KERN_BOOTTIME failed: %m"); return (SNMP_ERR_GENERR);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701090105.v0915i4d085170>