diff options
Diffstat (limited to 'ext/socket/getaddrinfo.c')
-rw-r--r-- | ext/socket/getaddrinfo.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c index e9ff9235e1..7ae41e6030 100644 --- a/ext/socket/getaddrinfo.c +++ b/ext/socket/getaddrinfo.c @@ -39,22 +39,28 @@ */ #include <sys/types.h> +#ifndef NT #include <sys/param.h> +#endif #ifdef HAVE_SYSCTL_H #include <sys/sysctl.h> #endif +#ifndef NT #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <arpa/nameser.h> #include <netdb.h> #include <resolv.h> +#include <unistd.h> +#else +#include <winsock2.h> +#endif #include <string.h> #include <stdio.h> #include <stdlib.h> #include <stddef.h> #include <ctype.h> -#include <unistd.h> #include "config.h" #include "addrinfo.h" @@ -355,7 +361,7 @@ getaddrinfo(hostname, servname, hints, res) pai->ai_socktype = SOCK_DGRAM; pai->ai_protocol = IPPROTO_UDP; } - port = htons(atoi(servname)); + port = htons((unsigned short)atoi(servname)); } else { struct servent *sp; char *proto; @@ -561,8 +567,10 @@ get_addr(hostname, af, res, pai, port0) int i, error = 0, h_error; char *ap; #ifndef INET6 +#ifndef NT extern int h_errno; #endif +#endif top = NULL; sentinel.ai_next = NULL; |