Author: ngie Date: Mon Jan 9 01:07:16 2017 New Revision: 311720 URL: https://svnweb.freebsd.org/changeset/base/311720
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/10/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c ============================================================================== --- stable/10/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c Mon Jan 9 01:05:44 2017 (r311719) +++ stable/10/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c Mon Jan 9 01:07:16 2017 (r311720) @@ -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); _______________________________________________ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"