[Nagiosplug-devel] Antwort: RFC: gethostbyname instead of getaddrinfo

Holger Weiss holger at CIS.FU-Berlin.DE
Tue Feb 10 17:40:40 CET 2009

* Sascha.Runschke at gfkl.com [2009-02-10 16:25]:
> getaddrinfo() should only be used in situations where it's really needed.

I disagree.  getaddrinfo allows for opening sockets in a protocol
independent manner and therefore makes implementing IPv6 support much
cleaner and simpler.  gethostbyname has been deprecated by the
introduction of getaddrinfo, see the APPLICATION USAGE and FUTURE
DIRECTIONS sections of the gethostbyname specification in POSIX.1-2001.¹
POSIX.1-2008 actually removed getaddrinfo.²

So, I'd rather suggest the opposite; that is, we should replace any
gethostbyname calls with calls to getaddrinfo.


¹ http://www.opengroup.org/onlinepubs/009695399/functions/gethostbyname.html
² http://www.opengroup.org/onlinepubs/9699919799/xrat/V4_xsh_chap01.html#tag_22_01_01_05

More information about the Devel mailing list