From: Gunnar Beutner Date: Wed, 6 Aug 2014 08:43:41 +0000 (+0200) Subject: Use gai_strerror instead of Utility::FormatErrorNumber for getaddrinfo's error codes X-Git-Tag: v2.0.2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8256638fdecaf47588fe99e4359133c2cbcd5b2f;p=icinga2 Use gai_strerror instead of Utility::FormatErrorNumber for getaddrinfo's error codes fixes #6849 --- diff --git a/lib/base/tcpsocket.cpp b/lib/base/tcpsocket.cpp index 0674702ac..2f7ab1fb6 100644 --- a/lib/base/tcpsocket.cpp +++ b/lib/base/tcpsocket.cpp @@ -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()