Am Wed, 8 Oct 2014 18:59:27 +0200 schrieb Volker Simonis <volker.simo...@gmail.com>: > - it may be also possible to complete omit the call to getnameinfo() > in that new implementation, because as far as I can see the > 'ai_canonname' field of the first addrinfo structure returned by > getaddrinfo() already contains the canonical name of the host if we > pass AI_CANONNAME as 'hints' to getaddrinfo (which we already do).
I completely agree. I mentioned this before. The flag can be removed or used, both would safe roundtrips: http://openjdk.5641.n7.nabble.com/RFC-compliant-address-selection-vs-home-made-getaddrinfo-td138848.html In the hostname utility (which I happen to maintain for Linux net-tools) gethostbyname() is used, btw. This does reduce the risk of stalls. https://sourceforge.net/p/net-tools/code/ci/master/tree/hostname.c#l146 But the whole hostname business is pretty much broken (unfortunatelly there is no way to repair that now). I think a function besides uts_name should have never been implemented. The is a host/node name and there are reverse resolved names for various addresses. Isnt really related. Especially not if a machine is multi-homed. Gruss Bernd