]> ruderich.org/simon Gitweb - tlsproxy/tlsproxy.git/blobdiff - tests/client.c
Fix error handling for getaddrinfo().
[tlsproxy/tlsproxy.git] / tests / client.c
index f98711fa02ffbf09afbafad2ed6a9577b152984c..d4edf7f8ba6f911fe674c1d1a697e21eb8bb908b 100644 (file)
@@ -185,7 +185,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) {
-        perror("connect_to_host(): getaddrinfo()");
+        if (gai_return == EAI_SYSTEM) {
+            perror("connect_to_host(): getaddrinfo()");
+        } else {
+            fprintf(stderr, "connect_to_host(): getaddrinfo(): %s",
+                            gai_strerror(gai_return));
+        }
         return -1;
     }