]> granicus.if.org Git - procps-ng/commitdiff
Stop SIGFPE on vmstat at times v3.3.5
authorCraig Small <csmall@enc.com.au>
Tue, 30 Oct 2012 10:48:34 +0000 (21:48 +1100)
committerCraig Small <csmall@enc.com.au>
Tue, 30 Oct 2012 10:48:34 +0000 (21:48 +1100)
Certain setups can crash vmstat with a SIGFPE, this small patch
catches those events

Bug-Debian: http://bugs.debian.org/677903

vmstat.c

index 93f620d142d1a59bea366b513c655aa8f7950482..c13376625ed35681ab5dacbabf7d74311bd2bd05 100644 (file)
--- a/vmstat.c
+++ b/vmstat.c
@@ -258,6 +258,7 @@ static void new_format(void)
        diow = *cpu_iow;
        dstl = *cpu_zzz;
        Div = duse + dsys + didl + diow + dstl;
+       if (!Div) Div = 1, didl = 1;
        divo2 = Div / 2UL;
        printf(format,
               running, blocked,
@@ -312,6 +313,7 @@ static void new_format(void)
                }
 
                Div = duse + dsys + didl + diow + dstl;
+               if (!Div) Div = 1, didl = 1;
                divo2 = Div / 2UL;
                printf(format,
                       running,