BIND 10 trac1784, updated. 438bcd6747bf177dfd6355c77c06d28560a1369a [1784] some initialization issues and cppcheck fixes

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Mar 19 14:27:32 UTC 2012


The branch, trac1784 has been updated
       via  438bcd6747bf177dfd6355c77c06d28560a1369a (commit)
      from  20e1bd7772429ac6d6fc2ec993da36985ce75984 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 438bcd6747bf177dfd6355c77c06d28560a1369a
Author: Jelte Jansen <jelte at isc.org>
Date:   Mon Mar 19 15:27:01 2012 +0100

    [1784] some initialization issues and cppcheck fixes
    
    see http://bind10.isc.org/ticket/1784#comment:5

-----------------------------------------------------------------------

Summary of changes:
 src/lib/asiodns/tests/dns_service_unittest.cc |   21 ++++++++++++++-------
 src/lib/resolve/Makefile.am                   |    1 +
 2 files changed, 15 insertions(+), 7 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/asiodns/tests/dns_service_unittest.cc b/src/lib/asiodns/tests/dns_service_unittest.cc
index 1a9654a..931c59a 100644
--- a/src/lib/asiodns/tests/dns_service_unittest.cc
+++ b/src/lib/asiodns/tests/dns_service_unittest.cc
@@ -177,6 +177,8 @@ protected:
         asio_service(io_service.get_io_service())
     {
         current_service = &io_service;
+        // Content shouldn't matter for the tests, but initialize anyway
+        memset(data, 1, sizeof(data));
     }
 
     ~UDPDNSServiceTest() {
@@ -226,7 +228,7 @@ protected:
 private:
     asio::ip::udp::socket client_socket;
     const asio::ip::udp::endpoint server_ep;
-    char data[4];           // the content doesn't matter for the test
+    char data[4];
 
     // To access them in signal handle function, the following
     // variables have to be static.
@@ -236,6 +238,11 @@ private:
     asio::io_service& asio_service;
 };
 
+// Need to define the non-const static members outside of the class
+// declaration
+IOService* UDPDNSServiceTest::current_service;
+bool UDPDNSServiceTest::io_service_is_time_out;
+
 // A helper socket FD creator for given address and port.  It's generally
 // expected to succeed; on failure it simply throws an exception to make
 // the test fail.
@@ -250,14 +257,14 @@ getSocketFD(int family, const char* const address, const char* const port) {
     int s = -1;
     int error = getaddrinfo(address, port, &hints, &res);
     if (error == 0) {
-        s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
-        if (s >= 0) {
-            error = bind(s, res->ai_addr, res->ai_addrlen);
+        if (res != NULL) {
+            s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
+            if (s >= 0) {
+                error = bind(s, res->ai_addr, res->ai_addrlen);
+            }
+            freeaddrinfo(res);
         }
     }
-    if (res != NULL) {
-        freeaddrinfo(res);
-    }
     if (error != 0) {
         if (s >= 0) {
             close(s);
diff --git a/src/lib/resolve/Makefile.am b/src/lib/resolve/Makefile.am
index ceccce8..4b81862 100644
--- a/src/lib/resolve/Makefile.am
+++ b/src/lib/resolve/Makefile.am
@@ -34,6 +34,7 @@ nodist_libresolve_la_SOURCES = resolve_messages.h resolve_messages.cc
 libresolve_la_LIBADD = $(top_builddir)/src/lib/dns/libdns++.la
 libresolve_la_LIBADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
 libresolve_la_LIBADD += $(top_builddir)/src/lib/log/liblog.la
+libresolve_la_LIBADD += $(top_builddir)/src/lib/asiodns/libasiodns.la
 
 # The message file should be in the distribution.
 EXTRA_DIST = resolve_messages.mes



More information about the bind10-changes mailing list