Call getaddrinfo() with AI_NUMERICSERV because the service is a port number.
authorHiroshi Inoue <inoue@tpf.co.jp>
Wed, 11 Dec 2013 11:50:02 +0000 (20:50 +0900)
committerHiroshi Inoue <inoue@tpf.co.jp>
Wed, 11 Dec 2013 11:53:50 +0000 (20:53 +0900)
socket.c

index 01ea56cf5d40cfe37cb8f1cc5c106ca1f1e2c9e1..61d36ecbdf8ff74f4af78262e9d1c3f95f8a1cf8 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -279,6 +279,7 @@ SOCK_connect_to(SocketClass *self, unsigned short port, char *hostname, long tim
        rest.ai_socktype = SOCK_STREAM;
        rest.ai_family = AF_UNSPEC;
        snprintf(portstr, sizeof(portstr), "%d", port);
+       rest.ai_flags |= AI_NUMERICSERV;
        if (is_numeric_address(hostname))
            /* don't resolve address in getaddrinfo() if not necessary */
            rest.ai_flags |= AI_NUMERICHOST;