From f5cb7e61b22309865cba7706e224d4ac282e6fdb Mon Sep 17 00:00:00 2001 From: Kees Monshouwer Date: Sat, 7 Sep 2013 14:08:56 +0200 Subject: [PATCH] avoid division by 0, and make coverity happy, or not... --- pdns/ws.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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%
"<