From: Axel Viala Date: Wed, 26 Oct 2022 17:23:00 +0000 (+0200) Subject: clang-tidy: Braces + avoid else after throw. X-Git-Tag: dnsdist-1.8.0-rc1~220^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=474573110bbb22c90b3621b4241677d197a4b07d;p=thirdparty%2Fpdns.git clang-tidy: Braces + avoid else after throw. --- diff --git a/pdns/dynlistener.cc b/pdns/dynlistener.cc index 5973d73921..10083422a9 100644 --- a/pdns/dynlistener.cc +++ b/pdns/dynlistener.cc @@ -268,20 +268,26 @@ string DynListener::getLine() } } else { - if(isatty(0) != 0) - if(write(1, "% ", 2) !=2) - throw PDNSException("Writing to console: "+stringerror()); + if (isatty(0) != 0) { + if (write(1, "% ", 2) != 2) { + throw PDNSException("Writing to console: " + stringerror()); + } + } ssize_t len = read(0, mesg.data(), mesg.size()); - if (len < 0) - throw PDNSException("Reading from the control pipe: "+stringerror()); - else if(len==0) + if (len < 0) { + throw PDNSException("Reading from the control pipe: " + stringerror()); + } + + if (len == 0) { throw PDNSException("Guardian exited - going down as well"); + } - if(static_cast(len) == mesg.size()) + if (static_cast(len) == mesg.size()) { throw PDNSException("Line on control console was too long"); + } - mesg[len]=0; + mesg[len] = 0; } return mesg.data();