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: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F1003%2Fhead;p=thirdparty%2Fpdns.git avoid division by 0, and make coverity happy, or not... --- diff --git a/pdns/ws.cc b/pdns/ws.cc index 2f0ce8a5a0..6506b4c916 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%
"<