From ed7e66471f7018f2e7e1c6a469e5cd758b913255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Fri, 11 Nov 2016 03:03:42 +0100 Subject: Add missing cstring include for strerror --- louloulibs/network/tcp_client_socket_handler.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/louloulibs/network/tcp_client_socket_handler.cpp b/louloulibs/network/tcp_client_socket_handler.cpp index 2de9696..f22d756 100644 --- a/louloulibs/network/tcp_client_socket_handler.cpp +++ b/louloulibs/network/tcp_client_socket_handler.cpp @@ -5,6 +5,7 @@ #include +#include #include #include @@ -27,7 +28,7 @@ void TCPClientSocketHandler::init_socket(const struct addrinfo* rp) if (this->socket != -1) ::close(this->socket); if ((this->socket = ::socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol)) == -1) - throw std::runtime_error("Could not create socket: "s + strerror(errno)); + throw std::runtime_error("Could not create socket: "s + std::strerror(errno)); // Bind the socket to a specific address, if specified if (!this->bind_addr.empty()) { @@ -66,7 +67,7 @@ void TCPClientSocketHandler::init_socket(const struct addrinfo* rp) const int existing_flags = ::fcntl(this->socket, F_GETFL, 0); if ((existing_flags == -1) || (::fcntl(this->socket, F_SETFL, existing_flags | O_NONBLOCK) == -1)) - throw std::runtime_error("Could not initialize socket: "s + strerror(errno)); + throw std::runtime_error("Could not initialize socket: "s + std::strerror(errno)); } void TCPClientSocketHandler::connect(const std::string& address, const std::string& port, const bool tls) @@ -176,11 +177,11 @@ void TCPClientSocketHandler::connect(const std::string& address, const std::stri "connection_timeout"s + std::to_string(this->socket))); return ; } - log_info("Connection failed:", strerror(errno)); + log_info("Connection failed:", std::strerror(errno)); } log_error("All connection attempts failed."); this->close(); - this->on_connection_failed(strerror(errno)); + this->on_connection_failed(std::strerror(errno)); return ; } -- cgit v1.2.3