Patchwork [libjava] Restore HAVE_INET6 tests (PR libgcj/52645)

login
register
mail settings
Submitter Rainer Orth
Date April 4, 2012, 11:33 a.m.
Message ID <yddobr7pw9b.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/150720/
State New
Headers show

Comments

Rainer Orth - April 4, 2012, 11:33 a.m.
It turns out I've been over-eager removing Tru64 UNIX support from
libjava, breaking at least the HP-UX 11.00 build.  The following patch
fixes this, tested by Dave Anglin on hppa2.0w-hp-hpux11.00 and
bootstrapped on i386-pc-solaris2.11.

Ok for mainline?

Thanks.
	Rainer


2012-03-21  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR libgcj/52645
	* gnu/java/net/natPlainDatagramSocketImplPosix.cc (setOption):
	Restore HAVE_INET6 check.
	* gnu/java/net/natPlainDatagramSocketImplWin32.cc (setOption):
	Likewise.
Tom Tromey - April 5, 2012, 7:28 p.m.
>>>>> "Rainer" == Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

Rainer> 2012-03-21  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
Rainer> 	PR libgcj/52645
Rainer> 	* gnu/java/net/natPlainDatagramSocketImplPosix.cc (setOption):
Rainer> 	Restore HAVE_INET6 check.
Rainer> 	* gnu/java/net/natPlainDatagramSocketImplWin32.cc (setOption):
Rainer> 	Likewise.

This is ok.

Tom

Patch

# HG changeset patch
# Parent e817b51d075737a1652e0b5630c8823a4b074cec
Restore HAVE_INET6 tests (PR libgcj/52645)

diff --git a/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc b/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc
--- a/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc
+++ b/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc
@@ -655,6 +655,7 @@  gnu::java::net::PlainDatagramSocketImpl:
 	    len = sizeof (struct in_addr);
 	    ptr = (const char *) &u.addr;
 	  }
+#ifdef HAVE_INET6
 	else if (len == 16)
 	  {
 	    level = IPPROTO_IPV6;
@@ -663,6 +664,7 @@  gnu::java::net::PlainDatagramSocketImpl:
 	    len = sizeof (struct in6_addr);
 	    ptr = (const char *) &u.addr6;
 	  }
+#endif
 	else
 	  throw
 	    new ::java::net::SocketException (JvNewStringUTF ("invalid length"));
diff --git a/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc b/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc
--- a/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc
+++ b/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc
@@ -540,6 +540,7 @@  gnu::java::net::PlainDatagramSocketImpl:
       len = sizeof (struct in_addr);
       ptr = (const char *) &u.addr;
     }
+#ifdef HAVE_INET6
   else if (len == 16)
     {
       level = IPPROTO_IPV6;
@@ -548,6 +549,7 @@  gnu::java::net::PlainDatagramSocketImpl:
       len = sizeof (struct in6_addr);
       ptr = (const char *) &u.addr6;
     }
+#endif
   else
     throw
       new ::java::net::SocketException (JvNewStringUTF ("invalid length"));
@@ -635,14 +637,14 @@  gnu::java::net::PlainDatagramSocketImpl:
         goto error;
       if (u.address.sin_family == AF_INET)
         {
-    laddr = JvNewByteArray (4);
-    memcpy (elements (laddr), &u.address.sin_addr, 4);
+	  laddr = JvNewByteArray (4);
+	  memcpy (elements (laddr), &u.address.sin_addr, 4);
         }
 #ifdef HAVE_INET6
-            else if (u.address.sin_family == AF_INET6)
+      else if (u.address.sin_family == AF_INET6)
         {
-    laddr = JvNewByteArray (16);
-    memcpy (elements (laddr), &u.address6.sin6_addr, 16);
+	  laddr = JvNewByteArray (16);
+	  memcpy (elements (laddr), &u.address6.sin6_addr, 16);
         }
 #endif
       else