]> ruderich.org/simon Gitweb - tlsproxy/tlsproxy.git/blobdiff - src/connection.c
Fix error handling for getaddrinfo().
[tlsproxy/tlsproxy.git] / src / connection.c
index 36e03048943f9d6bc00f6f3f342f74f845a54e32..f608339f8014ba0427f515c36a14f1d29a51e894 100644 (file)
@@ -770,7 +770,12 @@ static int connect_to_host(const char *hostname, const char *port) {
                           | AI_V4MAPPED;   /* support IPv4 through IPv6 */
     gai_return = getaddrinfo(hostname, port, &gai_hints, &gai_result);
     if (gai_return != 0) {
-        LOG_PERROR(LOG_WARNING, "connect_to_host(): getaddrinfo()");
+        if (gai_return == EAI_SYSTEM) {
+            LOG_PERROR(LOG_WARNING, "connect_to_host(): getaddrinfo()");
+        } else {
+            LOG(LOG_WARNING, "connect_to_host(): getaddrinfo(): %s",
+                             gai_strerror(gai_return));
+        }
         return -1;
     }