X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/2f61d1d75ac52f239e760ecea02332eedc4682bd..3b7fa78b1de8f9ee8718cba3da3b2db522b70620:/src/compat.c diff --git a/src/compat.c b/src/compat.c index a810265..61d9f74 100644 --- a/src/compat.c +++ b/src/compat.c @@ -11,6 +11,9 @@ #ifdef HAVE_MEMORY_H # include #endif +#ifdef HAVE_ARPA_INET_H +# include +#endif #if !defined(HAVE_GETTIMEOFDAY) && defined(HAVE_FTIME) extern gettimeofday(struct timeval * tv, struct timezone * tz); @@ -363,8 +366,14 @@ int getaddrinfo(const char *node, const char *service, const struct addrinfo *hi if (node) { if (hints && hints->ai_flags & AI_NUMERICHOST) { +#if HAVE_INET_ATON if (!inet_aton(node, &sin.sin_addr)) return 2; +#else + sin.sin_addr.s_addr = inet_addr(node); + if (sin.sin_addr.s_addr == INADDR_NONE) + return 2; +#endif } else { struct hostent *he; he = gethostbyname(node);