[master] 1401f91 Division by zero is undefined

Federico G. Schwindt fgsch at lodoss.net
Fri May 12 11:34:05 CEST 2017


commit 1401f910331bc6a7d51f82a29e3e7cb3562afa7a
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Thu May 11 02:38:15 2017 +0100

    Division by zero is undefined

diff --git a/bin/varnishstat/varnishstat.c b/bin/varnishstat/varnishstat.c
index 5065d84..7650bf1 100644
--- a/bin/varnishstat/varnishstat.c
+++ b/bin/varnishstat/varnishstat.c
@@ -192,7 +192,8 @@ do_once_cb(void *priv, const struct VSC_point * const pt)
 	printf("%*.*s", op->pad - i, op->pad - i, "");
 	if (pt->desc->semantics == 'c')
 		printf("%12ju %12.2f %s\n",
-		    (uintmax_t)val, val / op->up, pt->desc->sdesc);
+		    (uintmax_t)val, op->up ? val / op->up : 0,
+		    pt->desc->sdesc);
 	else
 		printf("%12ju %12s %s\n",
 		    (uintmax_t)val, ".  ", pt->desc->sdesc);



More information about the varnish-commit mailing list