]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Use FDWrapper
authorOtto <otto.moerbeek@open-xchange.com>
Fri, 29 Oct 2021 13:41:34 +0000 (15:41 +0200)
committerOtto <otto.moerbeek@open-xchange.com>
Fri, 29 Oct 2021 13:41:34 +0000 (15:41 +0200)
pdns/pdns_recursor.cc

index 9f0e8e4d04b50ecb006eeaacd8f09d44d2651fae..79e30ee9c018e1951f62666126d48ed718208d70 100644 (file)
@@ -4206,9 +4206,8 @@ template ThreadTimes broadcastAccFunction(const boost::function<ThreadTimes*()>&
 
 static void handleRCC(int fd, FDMultiplexer::funcparam_t& var)
 {
-  int clientfd;
   try {
-    clientfd = accept(fd, nullptr, nullptr);
+    FDWrapper clientfd = accept(fd, nullptr, nullptr);
     if (clientfd == -1) {
       throw PDNSException("accept failed");
     }
@@ -4228,9 +4227,6 @@ static void handleRCC(int fd, FDMultiplexer::funcparam_t& var)
   catch(const PDNSException& ae) {
     g_log<<Logger::Error<<"Error dealing with control socket request: "<<ae.reason<<endl;
   }
-  if (clientfd != -1) {
-    close(clientfd);
-  }
 }
 
 static void TCPIOHandlerStateChange(IOState oldstate, IOState newstate, std::shared_ptr<PacketID>& pid)