]> granicus.if.org Git - icinga2/commitdiff
Bugfix for TCPSocket::Bind()
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 7 May 2012 11:58:22 +0000 (13:58 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 7 May 2012 11:58:22 +0000 (13:58 +0200)
base/tcpsocket.cpp

index d242ab8e68f766a25b99d8db83faf4cd2f2cf6ec..9f08ae2f09722c90819b5260b4488e2c77a70d51 100644 (file)
@@ -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;