diff options
| author | Gordon Sim <gsim@apache.org> | 2012-07-10 19:22:54 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2012-07-10 19:22:54 +0000 |
| commit | 91d37992d85ae721e1ab2e0549d43bf464553a4b (patch) | |
| tree | 73d778620ebb5911bfac2ee3c934a891d5959b0a /cpp/src | |
| parent | 05315de2c144f3064858c657f532ec7b1befcfa4 (diff) | |
| download | qpid-python-91d37992d85ae721e1ab2e0549d43bf464553a4b.tar.gz | |
QPID-4127: Ensure SystemInfo::isLocalHost() returns true for ::1
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1359855 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
| -rwxr-xr-x | cpp/src/qpid/sys/posix/SystemInfo.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cpp/src/qpid/sys/posix/SystemInfo.cpp b/cpp/src/qpid/sys/posix/SystemInfo.cpp index 007d0773fc..2b1bbb97df 100755 --- a/cpp/src/qpid/sys/posix/SystemInfo.cpp +++ b/cpp/src/qpid/sys/posix/SystemInfo.cpp @@ -34,6 +34,7 @@ #include <fstream> #include <sstream> #include <netdb.h> +#include <string.h> #ifndef HOST_NAME_MAX # define HOST_NAME_MAX 256 @@ -125,7 +126,10 @@ namespace { struct AddrInfo { struct addrinfo* ptr; AddrInfo(const std::string& host) : ptr(0) { - if (::getaddrinfo(host.c_str(), NULL, NULL, &ptr) != 0) + ::addrinfo hints; + ::memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; // Allow both IPv4 and IPv6 + if (::getaddrinfo(host.c_str(), NULL, &hints, &ptr) != 0) ptr = 0; } ~AddrInfo() { if (ptr) ::freeaddrinfo(ptr); } |
