gethostbyname is obsolete and deprecated
From the man page:
The gethostbyname*(), gethostbyaddr*(), herror(), and hstrerror() functions are obsolete. Applications should use getaddrinfo(3), getnameinfo(3), and gai_strerror(3) instead.
Additionally, there was a recently-fixed bug (null-deref) in our historic use of gethostbyname() (in resolve_ip(), initially) that was copy/pasted to several other places. We should have a robust version of resolve_ip() in xpdev and reuse that everywhere we need that functionality (and add IPv6 support while we're at it).