FYI: Fix InetAddress.getByName and loopback issues

Andreas Tobler toa@pop.agri.ch
Mon Aug 16 18:57:00 GMT 2004


I commited the patch below after successful bootstrap on darwin.
And after talking with Tom Tromey.

Andreas

> 2004-08-14  Andreas Tobler  <a.tobler@schweiz.ch>
> 
>     * java/net/natInetAddressPosix.cc (lookup): Reflect rename of
>     localhostAddress to loopbackAddress.
>     * java/net/natInetAddressWin32.cc (lookup): Likewise.
> 
> 
> ------------------------------------------------------------------------
> 
> Index: java/net/natInetAddressWin32.cc
> ===================================================================
> RCS file: /cvs/gcc/gcc/libjava/java/net/natInetAddressWin32.cc,v
> retrieving revision 1.6
> diff -u -r1.6 natInetAddressWin32.cc
> --- java/net/natInetAddressWin32.cc	30 Nov 2003 21:02:56 -0000	1.6
> +++ java/net/natInetAddressWin32.cc	14 Aug 2004 02:37:36 -0000
> @@ -60,7 +60,7 @@
>  
>        // FIXME: this is insufficient if some other piece of code calls
>        // this gethostbyname.
> -      JvSynchronize sync (java::net::InetAddress::localhostAddress);
> +      JvSynchronize sync (java::net::InetAddress::loopbackAddress);
>        hptr = gethostbyname (hostname);
>      }
>    else
> @@ -87,7 +87,7 @@
>  
>        // FIXME: this is insufficient if some other piece of code calls
>        // this gethostbyaddr.
> -      JvSynchronize sync (java::net::InetAddress::localhostAddress);
> +      JvSynchronize sync (java::net::InetAddress::loopbackAddress);
>        hptr = gethostbyaddr (val, len, type);
>      }
>    if (hptr != NULL)
> Index: java/net/natInetAddressPosix.cc
> ===================================================================
> RCS file: /cvs/gcc/gcc/libjava/java/net/natInetAddressPosix.cc,v
> retrieving revision 1.4
> diff -u -r1.4 natInetAddressPosix.cc
> --- java/net/natInetAddressPosix.cc	13 Aug 2004 22:17:34 -0000	1.4
> +++ java/net/natInetAddressPosix.cc	14 Aug 2004 02:37:36 -0000
> @@ -167,7 +167,7 @@
>  #else
>        // FIXME: this is insufficient if some other piece of code calls
>        // this gethostbyname.
> -      JvSynchronize sync (java::net::InetAddress::localhostAddress);
> +      JvSynchronize sync (java::net::InetAddress::loopbackAddress);
>        hptr = gethostbyname (hostname);
>  #endif /* HAVE_GETHOSTBYNAME_R */
>      }
> @@ -221,7 +221,7 @@
>  #else /* HAVE_GETHOSTBYADDR_R */
>        // FIXME: this is insufficient if some other piece of code calls
>        // this gethostbyaddr.
> -      JvSynchronize sync (java::net::InetAddress::localhostAddress);
> +      JvSynchronize sync (java::net::InetAddress::loopbackAddress);
>        hptr = gethostbyaddr (val, len, type);
>  #endif /* HAVE_GETHOSTBYADDR_R */
>      }



More information about the Java-patches mailing list