]> granicus.if.org Git - pdns/commitdiff
log nice error message as well as throwing exception
authorMark Zealey <mark@markandruth.co.uk>
Fri, 6 Dec 2013 08:34:15 +0000 (10:34 +0200)
committerMark Zealey <mark@markandruth.co.uk>
Fri, 6 Dec 2013 08:34:15 +0000 (10:34 +0200)
pdns/nameserver.cc

index c5b0bb036591996d48753b03e2c5f8a20057e490..9c9eddf3267142f56c06a0db3e7e99172f0bc93f 100644 (file)
@@ -105,8 +105,10 @@ void UDPNameserver::bindIPv4()
 
     s=socket(AF_INET,SOCK_DGRAM,0);
 
-    if(s<0)
+    if(s<0) {
+      L<<Logger::Error<<"Unable to acquire a UDP socket: "+string(strerror(errno)) << endl;
       throw PDNSException("Unable to acquire a UDP socket: "+string(strerror(errno)));
+    }
   
     Utility::setCloseOnExec(s);
   
@@ -197,8 +199,10 @@ void UDPNameserver::bindIPv6()
     string localname(*i);
 
     s=socket(AF_INET6,SOCK_DGRAM,0);
-    if(s<0)
+    if(s<0) {
+      L<<Logger::Error<<"Unable to acquire a UDPv6 socket: "+string(strerror(errno)) << endl;
       throw PDNSException("Unable to acquire a UDPv6 socket: "+string(strerror(errno)));
+    }
 
     Utility::setCloseOnExec(s);
     if(!Utility::setNonBlocking(s))