aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/net/natInetAddress.cc
diff options
context:
space:
mode:
authorTom Tromey <tromey@cygnus.com>1999-04-14 11:07:51 +0000
committerTom Tromey <tromey@gcc.gnu.org>1999-04-14 11:07:51 +0000
commit9ce392afc11b35f38e07b2d0fe5bfa185ff60c03 (patch)
treea8b990639562638134a7fd4bda47d244d7e98248 /libjava/java/net/natInetAddress.cc
parentd8265d2995912b37d74cd9a9dd18f5beff04e66d (diff)
downloadgcc-9ce392afc11b35f38e07b2d0fe5bfa185ff60c03.zip
gcc-9ce392afc11b35f38e07b2d0fe5bfa185ff60c03.tar.gz
gcc-9ce392afc11b35f38e07b2d0fe5bfa185ff60c03.tar.bz2
natInetAddress.cc (lookup): On glibc2.0 systems, make buffer larger to work around bug.
* java/net/natInetAddress.cc (lookup): On glibc2.0 systems, make buffer larger to work around bug. From Bryce McKinlay <bryce@albatross.co.nz>. From-SVN: r26447
Diffstat (limited to 'libjava/java/net/natInetAddress.cc')
-rw-r--r--libjava/java/net/natInetAddress.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/libjava/java/net/natInetAddress.cc b/libjava/java/net/natInetAddress.cc
index 9d5f93e..c591ea6 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