BIND 10 trac2987, updated. 98bcbd53342827be7a5be66f8ba69f7e37559c2c [2987] Changes as a result of the review.

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Jun 4 15:34:31 UTC 2013


The branch, trac2987 has been updated
       via  98bcbd53342827be7a5be66f8ba69f7e37559c2c (commit)
      from  77def77e9ab95155f91dcd9506de0f8ea1001d8a (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 98bcbd53342827be7a5be66f8ba69f7e37559c2c
Author: Marcin Siodelski <marcin at isc.org>
Date:   Tue Jun 4 17:34:16 2013 +0200

    [2987] Changes as a result of the review.

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

Summary of changes:
 src/lib/dhcp/tests/pkt_filter_inet_unittest.cc |   13 ++++++-------
 src/lib/dhcp/tests/pkt_filter_lpf_unittest.cc  |   13 ++++++-------
 2 files changed, 12 insertions(+), 14 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dhcp/tests/pkt_filter_inet_unittest.cc b/src/lib/dhcp/tests/pkt_filter_inet_unittest.cc
index 5607103..eaf2e62 100644
--- a/src/lib/dhcp/tests/pkt_filter_inet_unittest.cc
+++ b/src/lib/dhcp/tests/pkt_filter_inet_unittest.cc
@@ -40,16 +40,13 @@ public:
 
     /// @brief Constructor
     ///
-    /// This constructor initializes socket_ member to the value of 0.
+    /// This constructor initializes socket_ member to a negative value.
     /// Explcit initialization is performed here because some of the
     /// tests do not initialize this value. In such cases, destructor
     /// could invoke close() on uninitialized socket descriptor which
-    /// would result in errors being reported by Valgrind. Note that
-    /// by initializing the class member to a valid socket descriptor
-    /// value (non-negative) we avoid Valgrind warning about trying to
-    /// close the invalid socket descriptor.
+    /// would result in errors being reported by Valgrind.
     PktFilterInetTest()
-        : socket_(0) {
+        : socket_(-1) {
         // Initialize ifname_ and ifindex_.
         loInit();
     }
@@ -60,7 +57,9 @@ public:
     ~PktFilterInetTest() {
         // Cleanup after each test. This guarantees
         // that the socket does not hang after a test.
-        close(socket_);
+        if (socket_ >= 0) {
+            close(socket_);
+        }
     }
 
     /// @brief Detect loopback interface.
diff --git a/src/lib/dhcp/tests/pkt_filter_lpf_unittest.cc b/src/lib/dhcp/tests/pkt_filter_lpf_unittest.cc
index 4587bd5..742a7c9 100644
--- a/src/lib/dhcp/tests/pkt_filter_lpf_unittest.cc
+++ b/src/lib/dhcp/tests/pkt_filter_lpf_unittest.cc
@@ -44,16 +44,13 @@ public:
 
     /// @brief Constructor
     ///
-    /// This constructor initializes socket_ member to the value of 0.
+    /// This constructor initializes socket_ member to a negative value.
     /// Explcit initialization is performed here because some of the
     /// tests do not initialize this value. In such cases, destructor
     /// could invoke close() on uninitialized socket descriptor which
-    /// would result in errors being reported by Valgrind. Note that
-    /// by initializing the class member to a valid socket descriptor
-    /// value (non-negative) we avoid Valgrind warning about trying to
-    /// close the invalid socket descriptor.
+    /// would result in errors being reported by Valgrind.
     PktFilterLPFTest()
-        : socket_(0) {
+        : socket_(-1) {
         // Initialize ifname_ and ifindex_.
         loInit();
     }
@@ -64,7 +61,9 @@ public:
     ~PktFilterLPFTest() {
         // Cleanup after each test. This guarantees
         // that the socket does not hang after a test.
-        close(socket_);
+        if (socket_ >= 0) {
+            close(socket_);
+        }
     }
 
     /// @brief Detect loopback interface.



More information about the bind10-changes mailing list