fix windows ipv6 test w/ getaddrinfo

This commit is contained in:
toddouska
2013-04-11 14:52:04 -07:00
parent 12f00a7acc
commit 997d6dccf3

View File

@@ -18,6 +18,7 @@
#include <wspiapi.h> #include <wspiapi.h>
#endif #endif
#define SOCKET_T unsigned int #define SOCKET_T unsigned int
#define SNPRINTF _snprintf
#else #else
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
@@ -40,6 +41,7 @@
#ifndef SO_NOSIGPIPE #ifndef SO_NOSIGPIPE
#include <signal.h> /* ignore SIGPIPE */ #include <signal.h> /* ignore SIGPIPE */
#endif #endif
#define SNPRINTF snprintf
#endif /* USE_WINDOWS_API */ #endif /* USE_WINDOWS_API */
#ifdef HAVE_CAVIUM #ifdef HAVE_CAVIUM
@@ -384,7 +386,7 @@ static INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer,
hints.ai_socktype = udp ? SOCK_DGRAM : SOCK_STREAM; hints.ai_socktype = udp ? SOCK_DGRAM : SOCK_STREAM;
hints.ai_protocol = udp ? IPPROTO_UDP : IPPROTO_TCP; hints.ai_protocol = udp ? IPPROTO_UDP : IPPROTO_TCP;
snprintf(strPort, sizeof(strPort), "%d", port); SNPRINTF(strPort, sizeof(strPort), "%d", port);
strPort[79] = '\0'; strPort[79] = '\0';
ret = getaddrinfo(peer, strPort, &hints, &answer); ret = getaddrinfo(peer, strPort, &hints, &answer);