You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2012/07/10 21:22:54 UTC
svn commit: r1359855 - /qpid/trunk/qpid/cpp/src/qpid/sys/posix/SystemInfo.cpp
Author: gsim
Date: Tue Jul 10 19:22:54 2012
New Revision: 1359855
URL: http://svn.apache.org/viewvc?rev=1359855&view=rev
Log:
QPID-4127: Ensure SystemInfo::isLocalHost() returns true for ::1
Modified:
qpid/trunk/qpid/cpp/src/qpid/sys/posix/SystemInfo.cpp
Modified: qpid/trunk/qpid/cpp/src/qpid/sys/posix/SystemInfo.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/posix/SystemInfo.cpp?rev=1359855&r1=1359854&r2=1359855&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/posix/SystemInfo.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/posix/SystemInfo.cpp Tue Jul 10 19:22:54 2012
@@ -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); }
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org