java/net/natPlainSocketImpl.cc: compilation error on Solaris

Warren Levy warrenl@cygnus.com
Thu Dec 2 19:02:00 GMT 1999


On Thu, 2 Dec 1999, Alexandre Petit-Bianco wrote:

> I'm getting a build error on Solaris with ...

> +  // Enable SO_REUSEADDR, so that servers can reuse ports left in TIME_WAIT.
> +  ::setsockopt(fnum, SOL_SOCKET, SO_REUSEADDR, &i, sizeof(i));

A cast here is required similar to the other java.net instances of an int 
used in the 4th parameter:

Index: natPlainSocketImpl.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/net/natPlainSocketImpl.cc,v
retrieving revision 1.14
diff -u -p -r1.14 natPlainSocketImpl.cc
--- natPlainSocketImpl.cc       1999/11/23 11:40:26     1.14
+++ natPlainSocketImpl.cc       1999/12/03 02:59:25
@@ -149,7 +149,7 @@ java::net::PlainSocketImpl::bind (java::
     goto error;
 
   // Enable SO_REUSEADDR, so that servers can reuse ports left in TIME_WAIT.
-  ::setsockopt(fnum, SOL_SOCKET, SO_REUSEADDR, &i, sizeof(i));
+  ::setsockopt(fnum, SOL_SOCKET, SO_REUSEADDR, (char *) &i, sizeof(i));
   
   if (::bind (fnum, ptr, len) == 0)
     {


That should take care of it, so go ahead and check it in once your build 
is working.  Let me know if there's still a problem.
--warrenl


More information about the Java mailing list