]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
calidns: Fix lints in sendmsg call 13528/head
authorFred Morcos <fred.morcos@open-xchange.com>
Thu, 23 Nov 2023 18:39:01 +0000 (19:39 +0100)
committerFred Morcos <fred.morcos@open-xchange.com>
Thu, 23 Nov 2023 18:40:53 +0000 (19:40 +0100)
pdns/calidns.cc

index dbfdbd65c2f3173a7c8d8194bd24aacaf6ac97c7..920a4df88c551b560d46e0440a76443e03db2ed5 100644 (file)
@@ -167,7 +167,6 @@ static void sendPackets(const vector<std::unique_ptr<Socket>>& sockets, const ve
     cmsgbuf_aligned cbuf;
   };
   vector<unique_ptr<Unit> > units;
-  int ret;
 
   for(const auto& p : packets) {
     count++;
@@ -179,11 +178,14 @@ static void sendPackets(const vector<std::unique_ptr<Socket>>& sockets, const ve
     }
 
     fillMSGHdr(&u.msgh, &u.iov, nullptr, 0, (char*)&(*p)[0], p->size(), &dest);
-    if((ret=sendmsg(sockets[count % sockets.size()]->getHandle(),
-                   &u.msgh, 0)))
-      if(ret < 0)
-             unixDie("sendmsg");
 
+    auto socketHandle = sockets[count % sockets.size()]->getHandle();
+    ssize_t sendmsgRet = sendmsg(socketHandle, &u.msgh, 0);
+    if (sendmsgRet != 0) {
+      if (sendmsgRet < 0) {
+        unixDie("sendmsg");
+      }
+    }
 
     if(!(count%burst)) {
       nBursts++;