summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtchang%redhat.com <devnull@localhost>2005-03-09 21:47:58 +0000
committerwtchang%redhat.com <devnull@localhost>2005-03-09 21:47:58 +0000
commit11bbb46c60b56e7bddcce74dce8f8f9d3ff82a9b (patch)
tree1db7760b63a0fbba7816e8e63f8e55827715ba98
parent9666f3d40229bf5b24663cd94112c2632c730d1b (diff)
downloadnspr-hg-11bbb46c60b56e7bddcce74dce8f8f9d3ff82a9b.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. Tag: NSPRPUB_PRE_4_2_CLIENT_BRANCH
-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();