getnameinfo (const struct sockaddr *sa, socklen_t salen,
char *host, DWORD hostlen, char *serv, DWORD servlen, int flags)
#else
-static int
+static int
getnameinfo (const struct sockaddr *sa, socklen_t salen,
char *host, int hostlen, char *serv, int servlen, int flags)
#endif
getaddrinfo (const char *node, const char *service,
const struct addrinfo *hints, struct addrinfo **res)
#else
-static int
+static int
getaddrinfo (const char *node, const char *service,
const struct addrinfo *hints, struct addrinfo **res)
#endif
port = 0;
else
{
- long d;
+ unsigned long d;
char *end;
d = strtoul (service, &end, 0);
if (entry == NULL)
{
/* not found, use replacement API instead */
- entry = getnameinfo;
+ entry = getnameinfo;
}
/* call API before replacing function pointer to avoid crash */
if ((entry == NULL) || (freentry == NULL))
{
/* not found, use replacement API instead */
- entry = getaddrinfo;
- freentry = freeaddrinfo;
+ entry = getaddrinfo;
+ freentry = freeaddrinfo;
}
/* call API before replacing function pointer to avoid crash */
result = entry (node, service, hints, res);
if (p_hints != NULL)
{
const int safe_flags =
- AI_NUMERICHOST |
- AI_NUMERICSERV |
AI_PASSIVE |
AI_CANONNAME |
- AI_ALL |
+ AI_NUMERICHOST |
+#ifdef AI_NUMERICSERV
+ AI_NUMERICSERV |
+#endif
+#ifdef AI_ALL
+ AI_ALL |
+#endif
+#ifdef AI_ADDRCONFIG
AI_ADDRCONFIG |
+#endif
+#ifdef AI_V4MAPPED
AI_V4MAPPED |
+#endif
0;
hints.ai_family = p_hints->ai_family;