[Bug 1233] java.net.Inet4AddressImpl.getLocalHostName() causes SIGBUS error

bugzilla-daemon at icedtea.classpath.org bugzilla-daemon at icedtea.classpath.org
Wed Dec 5 08:02:32 PST 2012


http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1233

--- Comment #11 from sato <yoshiki at sendme.email.ne.jp> ---
(In reply to comment #10)
> (In reply to comment #9)
> > So that bug needs backporting presumably.
> 
> (In reply to comment #8)
> > This can be fixed by following the change here.
> > http://hg.openjdk.java.net/jdk7/jdk7/jdk/rev/ab13f19ee0ff
> 
> Are you sure?  Do you really have a hostname that is so very long?

I'm not sure because the hostname is not so long.  Another changes I made on
Inet4AddressImpl.c to follow the latest version of jdk7 is here:

@@ -82,10 +77,8 @@
          */
 #endif /* __linux__ */
         struct hostent res, res2, *hp;

-        char buf[HENT_BUF_SIZE];
-        char buf2[HENT_BUF_SIZE];
+       char *buf[HENT_BUF_SIZE/(sizeof (char *))];
+       char *buf2[HENT_BUF_SIZE/(sizeof (char *))];

@@ -94,21 +87,17 @@
         hostname[MAXHOSTNAMELEN] = '\0';

 #ifdef __GLIBC__
-         gethostbyname_r(hostname, &res, buf, sizeof(buf), &hp, &h_error);
+         gethostbyname_r(hostname, &res, (char*)buf, sizeof(buf), &hp,
&h_error);
 #else
-         hp = gethostbyname_r(hostname, &res, buf, sizeof(buf), &h_error);
+         hp = gethostbyname_r(hostname, &res, (char*)buf, sizeof(buf),
&h_error);
 #endif
         if (hp) {
 #ifdef __GLIBC__
             gethostbyaddr_r(hp->h_addr, hp->h_length, AF_INET,
-                            &res2, buf2, sizeof(buf2), &hp, &h_error);
+                            &res2, (char*)buf2, sizeof(buf2), &hp, &h_error);
 #else
             hp = gethostbyaddr_r(hp->h_addr, hp->h_length, AF_INET,
-                                  &res2, buf2, sizeof(buf2), &h_error);
+                                  &res2, (char*)buf2, sizeof(buf2), &h_error);
 #endif

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20121205/16844bb2/attachment.html 


More information about the distro-pkg-dev mailing list