summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtchang%redhat.com <devnull@localhost>2005-03-09 21:51:58 +0000
committerwtchang%redhat.com <devnull@localhost>2005-03-09 21:51:58 +0000
commitabe009c280a1a66650184858b2784866f1d3b541 (patch)
treedd69a25cb884c511e243ad0f6382d1a8514f7f83
parentcef7f70a3de4bed77d5a1df4a4bd5f2c7af110e2 (diff)
downloadnspr-hg-abe009c280a1a66650184858b2784866f1d3b541.tar.gz
Bugzilla Bug 100776: make a copy of the sockaddr structure and pass the
copy to connect because connect modifies the sockaddr structure. The patch is contributed by Julien Pierre of Sun. r=wtc.
-rw-r--r--pr/src/md/os2/os2sock.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pr/src/md/os2/os2sock.c b/pr/src/md/os2/os2sock.c
index 36a59c08..d1b2fdd3 100644
--- a/pr/src/md/os2/os2sock.c
+++ b/pr/src/md/os2/os2sock.c
@@ -307,6 +307,9 @@ _PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen,
PRInt32 rv, err;
PRThread *me = _PR_MD_CURRENT_THREAD();
PRInt32 osfd = fd->secret->md.osfd;
+ PRNetAddr addrCopy = *addr; /* Work around a bug in OS/2 where connect
+ * modifies the sockaddr structure.
+ * See Bugzilla bug 100776. */
/*
* We initiate the connection setup by making a nonblocking connect()
@@ -321,7 +324,7 @@ _PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen,
*/
retry:
- if ((rv = connect(osfd, (struct sockaddr *)addr, addrlen)) == -1)
+ if ((rv = connect(osfd, (struct sockaddr *)&addrCopy, addrlen)) == -1)
{
err = sock_errno();