]> granicus.if.org Git - icinga2/commitdiff
Use gai_strerror instead of Utility::FormatErrorNumber for getaddrinfo's error codes
authorGunnar Beutner <gunnar.beutner@netways.de>
Wed, 6 Aug 2014 08:43:41 +0000 (10:43 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Wed, 6 Aug 2014 08:43:41 +0000 (10:43 +0200)
fixes #6849

lib/base/tcpsocket.cpp

index 0674702aca26bd1643cc5b52778cb6c42982f7de..2f7ab1fb6d2b8bf0638b584848e36b1579b56800 100644 (file)
@@ -63,7 +63,7 @@ void TcpSocket::Bind(const String& node, const String& service, int family)
 
        if (rc != 0) {
                std::ostringstream msgbuf;
-               msgbuf << "getaddrinfo() failed with return code " << rc << ", \"" << Utility::FormatErrorNumber(rc) << "\"";
+               msgbuf << "getaddrinfo() failed with return code " << rc << ", \"" << gai_strerror(rc) << "\"";
                Log(LogCritical, "TcpSocket",  msgbuf.str());
 
                BOOST_THROW_EXCEPTION(socket_error()
@@ -156,7 +156,7 @@ void TcpSocket::Connect(const String& node, const String& service)
 
        if (rc != 0) {
                std::ostringstream msgbuf;
-               msgbuf << "getaddrinfo() failed with return code " << rc << ", \"" << Utility::FormatErrorNumber(rc) << "\"";
+               msgbuf << "getaddrinfo() failed with return code " << rc << ", \"" << gai_strerror(rc) << "\"";
                Log(LogCritical, "TcpSocket",  msgbuf.str());
 
                BOOST_THROW_EXCEPTION(socket_error()