Browse Source

[1539] use getSALength() instead of sa_len to calculate the length of sockaddr.

the latter isn't very portable.
JINMEI Tatuya 13 years ago
parent
commit
fedb6edd4f
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/bin/auth/tests/auth_srv_unittest.cc

+ 4 - 1
src/bin/auth/tests/auth_srv_unittest.cc

@@ -16,6 +16,8 @@
 
 #include <gtest/gtest.h>
 
+#include <util/io/sockaddr_util.h>
+
 #include <dns/message.h>
 #include <dns/messagerenderer.h>
 #include <dns/name.h>
@@ -56,6 +58,7 @@ using namespace std;
 using namespace isc::cc;
 using namespace isc::dns;
 using namespace isc::util;
+using namespace isc::util::io::internal;
 using namespace isc::util::unittests;
 using namespace isc::dns::rdata;
 using namespace isc::data;
@@ -1428,7 +1431,7 @@ checkAddrPort(const struct sockaddr& actual_sa,
               const string& expected_addr, uint16_t expected_port)
 {
     char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
-    const int error = getnameinfo(&actual_sa, actual_sa.sa_len, hbuf,
+    const int error = getnameinfo(&actual_sa, getSALength(actual_sa), hbuf,
                                   sizeof(hbuf), sbuf, sizeof(sbuf),
                                   NI_NUMERICHOST | NI_NUMERICSERV);
     if (error != 0) {