This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: Zero out SockAddr in bind()
- From: Mohan Embar <gnustuff at thisiscool dot com>
- To: java-patches at gcc dot gnu dot org
- Cc: tromey at redhat dot com
- Date: Sun, 23 Jul 2006 19:38:36 -0500
- Subject: Patch: FYI: Zero out SockAddr in bind()
- Reply-to: gnustuff at thisiscool dot com
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;