--- net-snmp-5.9.4/agent/mibgroup/ucd-snmp/vmstat_solaris2.c.orig +++ net-snmp-5.9.4/agent/mibgroup/ucd-snmp/vmstat_solaris2.c @@ -710,7 +710,12 @@ case CPUIDLE: return ((u_char *) (&cpu_perc[CPU_IDLE])); case CPURAWUSER: - take_snapshot(&raw_values); + /* Take the current snapshot */ + if ((take_snapshot(&raw_values) == -1) && (raw_values.css_cpus == 0)) { + snmp_log(LOG_WARNING, + "vmstat_solaris2 (var_extensible_vmstat): Something went wrong with take_snapshot.\n"); + return (NULL); + } /* * LINTED has to be 'long' */ @@ -724,7 +729,12 @@ * (Has been changed to Counter32 in the latest MIB version!) */ case CPURAWSYSTEM: - take_snapshot(&raw_values); + /* Take the current snapshot */ + if ((take_snapshot(&raw_values) == -1) && (raw_values.css_cpus == 0)) { + snmp_log(LOG_WARNING, + "vmstat_solaris2 (var_extensible_vmstat): Something went wrong with take_snapshot.\n"); + return (NULL); + } /* * LINTED has to be 'long' */ @@ -733,7 +743,12 @@ raw_values.css_cpu[CPU_WAIT]) / raw_values.css_cpus); return ((u_char *) (&long_ret)); case CPURAWIDLE: - take_snapshot(&raw_values); + /* Take the current snapshot */ + if ((take_snapshot(&raw_values) == -1) && (raw_values.css_cpus == 0)) { + snmp_log(LOG_WARNING, + "vmstat_solaris2 (var_extensible_vmstat): Something went wrong with take_snapshot.\n"); + return (NULL); + } /* * LINTED has to be 'long' */ @@ -741,7 +756,12 @@ (long) (raw_values.css_cpu[CPU_IDLE] / raw_values.css_cpus); return ((u_char *) (&long_ret)); case CPURAWWAIT: - take_snapshot(&raw_values); + /* Take the current snapshot */ + if ((take_snapshot(&raw_values) == -1) && (raw_values.css_cpus == 0)) { + snmp_log(LOG_WARNING, + "vmstat_solaris2 (var_extensible_vmstat): Something went wrong with take_snapshot.\n"); + return (NULL); + } /* * LINTED has to be 'long' */ @@ -749,7 +769,12 @@ (long) (raw_values.css_cpu[CPU_WAIT] / raw_values.css_cpus); return ((u_char *) (&long_ret)); case CPURAWKERNEL: - take_snapshot(&raw_values); + /* Take the current snapshot */ + if ((take_snapshot(&raw_values) == -1) && (raw_values.css_cpus == 0)) { + snmp_log(LOG_WARNING, + "vmstat_solaris2 (var_extensible_vmstat): Something went wrong with take_snapshot.\n"); + return (NULL); + } /* * LINTED has to be 'long' */