From: Otto Moerbeek Date: Tue, 18 Jun 2019 09:22:25 +0000 (+0200) Subject: Comments from pieterlexis: comment args, restructure "no ancestor found" case, zap... X-Git-Tag: dnsdist-1.4.0-rc1~115^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=239c8386302e1c93bd39865eb9f882592d54790f;p=thirdparty%2Fpdns.git Comments from pieterlexis: comment args, restructure "no ancestor found" case, zap newlines in trace. --- diff --git a/pdns/syncres.cc b/pdns/syncres.cc index b7334e4fca..901c7bcd16 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -597,15 +597,15 @@ int SyncRes::doResolve(const DNSName &qname, const QType &qtype, vector beenthereIgnored; getBestNSFromCache(qname, qtype, bestns, &flawedNSSet, depth + 1, beenthereIgnored); } - DNSName ancestor; - if (bestns.size() > 0) { - ancestor = bestns[0].d_name; - QLOG("Step1 Ancestor from cache is " << ancestor.toString()); - } else { + + if (bestns.size() == 0) { + // Something terrible is wrong QLOG("Step1 No ancestor found return ServFail"); return RCode::ServFail; } + const DNSName& ancestor(bestns[0].d_name); + QLOG("Step1 Ancestor from cache is " << ancestor.toString()); child = ancestor; unsigned int targetlen = std::min(child.countLabels() + (i > 3 ? 3 : 1), qnamelen); @@ -624,7 +624,7 @@ int SyncRes::doResolve(const DNSName &qname, const QType &qtype, vector&ret, unsigned int depth, set& beenthere, vState& state, bool *fromCache, StopAtDelegation *stopAtDelegation)