summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-01-05 01:39:25 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-01-05 01:39:25 +0000
commit57aa6227eec11ee3adc1e0937b05ecc71da6c47e (patch)
tree6b77ef6d4ad3278e35eec1884c7591bbc0497a61 /bin
parent2dd4305b1ca719879643d830e9d61cf4ec705bd1 (diff)
work around a very rare div by 0 that should not happen, but can happen on
non-IEEE systems apparently. like the vax. this is in the same area of code that has caused us problems with the 68060/68040 before; very curious, and i don't know why.
Diffstat (limited to 'bin')
-rw-r--r--bin/ps/print.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c
index 1ede786ce71..e91a2c1f92e 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print.c,v 1.28 2002/12/19 21:29:46 mickey Exp $ */
+/* $OpenBSD: print.c,v 1.29 2003/01/05 01:39:24 deraadt Exp $ */
/* $NetBSD: print.c,v 1.27 1995/09/29 21:58:12 cgd Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94";
#else
-static char rcsid[] = "$OpenBSD: print.c,v 1.28 2002/12/19 21:29:46 mickey Exp $";
+static char rcsid[] = "$OpenBSD: print.c,v 1.29 2003/01/05 01:39:24 deraadt Exp $";
#endif
#endif /* not lint */
@@ -558,6 +558,8 @@ getpcpu(k)
d = 0.0; /* avoid IEEE underflow */
else
d = exp(d);
+ if (d == 1.0)
+ return (0.0);
return (100.0 * fxtofl(p->p_pctcpu) /
(1.0 - d));
}