From: Gunnar Beutner Date: Mon, 7 May 2012 11:58:22 +0000 (+0200) Subject: Bugfix for TCPSocket::Bind() X-Git-Tag: v0.0.1~561 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fbfff23923697eefa03c9398b61d0cd8d89a21cf;p=icinga2 Bugfix for TCPSocket::Bind() --- diff --git a/base/tcpsocket.cpp b/base/tcpsocket.cpp index d242ab8e6..9f08ae2f0 100644 --- a/base/tcpsocket.cpp +++ b/base/tcpsocket.cpp @@ -28,12 +28,12 @@ void TCPSocket::Bind(string node, string service, int family) addrinfo *result; memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_UNSPEC; + hints.ai_family = family; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; hints.ai_flags = AI_PASSIVE; - if (getaddrinfo(node.c_str(), service.c_str(), &hints, &result) < 0) { + if (getaddrinfo(node.empty() ? NULL : node.c_str(), service.c_str(), &hints, &result) < 0) { HandleSocketError(); return;