Blob Blame History Raw
501210:  net-snmp SIGFPE 0x00002aaaab37744a in var_hrproc (vp=0x7fffffffbf50)

Author: Jan Safranek <jsafrane@redhat.com>
Upstream as SVN rev. 17616.

Index: net-snmp/agent/mibgroup/host/hr_proc.c
===================================================================
--- net-snmp/agent/mibgroup/host/hr_proc.c	(revision 17615)
+++ net-snmp/agent/mibgroup/host/hr_proc.c	(working copy)
@@ -182,7 +182,10 @@
             return NULL;
 
         long_return  = (cpu->idle_ticks  - cpu->history[0].idle_hist)*100;
-        long_return /= (cpu->total_ticks - cpu->history[0].total_hist);
+        if (cpu->total_ticks > cpu->history[0].total_hist) /* avoid div. by 0 */
+            long_return /= (cpu->total_ticks - cpu->history[0].total_hist);
+        else
+            long_return = 0; 
         long_return  = 100 - long_return;
         if (long_return < 0)
             long_return = 0;