]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
clang-tidy: Braces + avoid else after throw.
authorAxel Viala <axel.viala@darnuria.eu>
Wed, 26 Oct 2022 17:23:00 +0000 (19:23 +0200)
committerAxel Viala <axel.viala@darnuria.eu>
Wed, 26 Oct 2022 17:28:45 +0000 (19:28 +0200)
pdns/dynlistener.cc

index 5973d7392166d4509edf8a23ba8c8f86395d63c4..10083422a918b1877a5a8f79198b60a4af73fda7 100644 (file)
@@ -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<size_t>(len) == mesg.size())
+    if (static_cast<size_t>(len) == mesg.size()) {
       throw PDNSException("Line on control console was too long");
+    }
 
-    mesg[len]=0;
+    mesg[len] = 0;
   }
 
   return mesg.data();