This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: Zero out SockAddr in bind()


Hi All,

Based on this preapproval:

http://gcc.gnu.org/ml/java/2006-07/msg00072.html

I checked the following patch in. It passed
a "make check" in libjava with no differences
on i686-pc-linux-gnu.

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/

2006-07-21  Mohan Embar  <gnustuff@thisiscool.com>

	* gnu/java/net/natPlainSocketImplPosix.cc (bind): Clear
	SockAddr before using - needed for OS X/PPC.

Index: gnu/java/net/natPlainSocketImplPosix.cc
===================================================================
--- gnu/java/net/natPlainSocketImplPosix.cc	(revision 115645)
+++ gnu/java/net/natPlainSocketImplPosix.cc	(working copy)
@@ -89,6 +89,11 @@
   int len = haddress->length;
   int i = 1;
 
+  // The following is needed for OS X/PPC, otherwise bind() fails with an
+  // error. I found the issue and following fix on some mailing list, but
+  // no explanation was given as to why this solved the problem.
+  memset (&u, 0, sizeof (u));
+
   if (len == 4)
     {
       u.address.sin_family = AF_INET;





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]