summaryrefslogtreecommitdiff
path: root/bin/csh
diff options
context:
space:
mode:
authorThomas Nordin <nordin@cvs.openbsd.org>2002-02-14 22:13:34 +0000
committerThomas Nordin <nordin@cvs.openbsd.org>2002-02-14 22:13:34 +0000
commit77e1b9b935625ce9914eaeebe2ea67231113374f (patch)
treeb796e796d300b58dafa56004b4f8c800f4622585 /bin/csh
parenta06793b7c3fc22a4da115feca73d893fe903efde (diff)
Avoid overflow in usage percent calculation. ok deraadt@
Diffstat (limited to 'bin/csh')
-rw-r--r--bin/csh/time.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/csh/time.c b/bin/csh/time.c
index 6ed8c3edc12..2d80f3c8248 100644
--- a/bin/csh/time.c
+++ b/bin/csh/time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: time.c,v 1.5 1997/11/15 21:51:31 todd Exp $ */
+/* $OpenBSD: time.c,v 1.6 2002/02/14 22:13:33 nordin Exp $ */
/* $NetBSD: time.c,v 1.7 1995/03/21 13:55:25 mycroft Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)time.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: time.c,v 1.5 1997/11/15 21:51:31 todd Exp $";
+static char rcsid[] = "$OpenBSD: time.c,v 1.6 2002/02/14 22:13:33 nordin Exp $";
#endif
#endif /* not lint */
@@ -174,7 +174,7 @@ prusage(r0, r1, e, b)
case 'P': /* percent time spent running */
/* check if it did not run at all */
- i = (ms == 0) ? 0 : (t * 1000 / ms);
+ i = (ms == 0) ? 0 : ((long long)t * 1000 / ms);
/* nn.n% */
(void) fprintf(cshout, "%ld.%01ld%%", i / 10, i % 10);
break;