diff --git a/ares/ares_getnameinfo.c b/ares/ares_getnameinfo.c index 3b8ca1dcb..4eeed94cd 100644 --- a/ares/ares_getnameinfo.c +++ b/ares/ares_getnameinfo.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #ifdef HAVE_ARPA_NAMESER_COMPAT_H #include @@ -32,6 +33,10 @@ #include #endif +#ifdef HAVE_UNISTD_H +#include +#endif + #include #include #include @@ -250,7 +255,7 @@ static char *lookup_service(unsigned short port, int flags, char *buf) else { struct servent *se; - char *proto; + const char *proto; if (flags & ARES_NI_UDP) proto = "udp"; @@ -319,7 +324,7 @@ static char *ares_striendstr(const char *s1, const char *s2) c2++; } } - if (c2 == c1 == NULL) + if (c2 == c1 && c2 == NULL) return (char *)c1_begin; return NULL; }