From: Kees Monshouwer Date: Sat, 7 Sep 2013 12:08:56 +0000 (+0200) Subject: avoid division by 0, and make coverity happy, or not... X-Git-Tag: rec-3.6.0-rc1~449^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f5cb7e61b22309865cba7706e224d4ac282e6fdb;p=pdns avoid division by 0, and make coverity happy, or not... --- diff --git a/pdns/ws.cc b/pdns/ws.cc index 2f0ce8a5a..6506b4c91 100644 --- a/pdns/ws.cc +++ b/pdns/ws.cc @@ -122,13 +122,14 @@ void printtable(ostringstream &ret, const string &ringname, const string &title, ret<<""; int printed=0; + int total=max(1,tot); for(vector >::const_iterator i=ring.begin();limit && i!=ring.end();++i,--limit) { - ret<<""<"<second; } ret<<""<"<"<"; ret<<"
"<first<<""<second<<""<< StatWebServer::makePercentage(i->second*100.0/tot)<<""<first<<""<second<<""<< StatWebServer::makePercentage(i->second*100.0/total)<<"
Rest:"<"<< StatWebServer::makePercentage((tot-printed)*100.0/tot)<<"Rest:"<"<< StatWebServer::makePercentage((tot-printed)*100.0/total)<<"Total:"<100%
"<