From f61d0d129f6e4c0b71c34d06bd7a1b80b87442dd Mon Sep 17 00:00:00 2001 From: tromey Date: Wed, 14 Apr 1999 11:07:51 +0000 Subject: * java/net/natInetAddress.cc (lookup): On glibc2.0 systems, make buffer larger to work around bug. From Bryce McKinlay . git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26447 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/java/net/natInetAddress.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libjava/java') diff --git a/libjava/java/net/natInetAddress.cc b/libjava/java/net/natInetAddress.cc index 9d5f93e857f..c591ea6f89e 100644 --- a/libjava/java/net/natInetAddress.cc +++ b/libjava/java/net/natInetAddress.cc @@ -97,7 +97,14 @@ java::net::InetAddress::lookup (jstring host, java::net::InetAddress* iaddr, struct hostent *hptr = NULL; #if defined (HAVE_GETHOSTBYNAME_R) || defined (HAVE_GETHOSTBYADDR_R) struct hostent hent_r; +#if defined (__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ == 0 + // glibc 2.0.7 has a bug where gethostbyname_r won't return an error + // if the buffer is too small. So in this case we size the buffer + // the same way that glibc does. This is fixed in glibc 2.1. + char fixed_buffer[1024]; +#else char fixed_buffer[200]; +#endif char *buffer_r = fixed_buffer; int size_r = sizeof (fixed_buffer); #endif -- cgit v1.2.3