]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
NIT: move len near usage.
authorAxel Viala <axel.viala@darnuria.eu>
Fri, 23 Sep 2022 10:13:40 +0000 (12:13 +0200)
committerAxel Viala <axel.viala@darnuria.eu>
Wed, 26 Oct 2022 17:28:45 +0000 (19:28 +0200)
pdns/dynlistener.cc

index 70a9270a6100ddff0844b56f9a5ab6958c7bbb30..5973d7392166d4509edf8a23ba8c8f86395d63c4 100644 (file)
@@ -214,8 +214,6 @@ string DynListener::getLine()
   vector<char> mesg;
   mesg.resize(1024000);
 
-  ssize_t len = 0;
-
   ComboAddress remote;
   socklen_t remlen=remote.getSocklen();
 
@@ -273,7 +271,9 @@ string DynListener::getLine()
     if(isatty(0) != 0)
       if(write(1, "% ", 2) !=2)
         throw PDNSException("Writing to console: "+stringerror());
-    if((len=read(0, mesg.data(), mesg.size())) < 0)
+
+    ssize_t len = read(0, mesg.data(), mesg.size());
+    if (len < 0)
       throw PDNSException("Reading from the control pipe: "+stringerror());
     else if(len==0)
       throw PDNSException("Guardian exited - going down as well");