Code Review 7024560: InetAddress.getLocalHost().getHostName() returns localhost for hostnames of length HOST_NAME_MAX

Alan Bateman Alan.Bateman at oracle.com
Wed Mar 9 09:16:02 PST 2011


Chris Hegarty wrote:
> :
> I tested on a few different Linux machines and instrumented the error 
> handling code, it is definitely failing with ENAMETOOLONG.
Okay, must be a glibc thing.  The changes you have look okay to me but 
would be nice to ensure that the hostname is null-terminated (for 
platforms that don't fail with ENAMETOOLONG).

-Alan.



More information about the net-dev mailing list