From 37e224ac8fe6896055ab76d73cbe5ca04f1c297c Mon Sep 17 00:00:00 2001 From: "wtc%netscape.com" Date: Thu, 9 Mar 2000 21:40:11 +0000 Subject: [PATCH] Bugzilla bug #31049: pass both null and non-null 'addr' argument to PR_Accept to catch this bug. --- nsprpub/pr/tests/socket.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nsprpub/pr/tests/socket.c b/nsprpub/pr/tests/socket.c index 316ec75c681..8ebdf5b9cbb 100644 --- a/nsprpub/pr/tests/socket.c +++ b/nsprpub/pr/tests/socket.c @@ -423,9 +423,11 @@ TCP_Server(void *arg) PR_PostSem(sp->addr_sem); for (i = 0; i < (num_tcp_clients * num_tcp_connections_per_client); i++) { + /* test both null and non-null 'addr' argument to PR_Accept */ + PRNetAddr *addrp = (i%2 ? &netaddr: NULL); DPRINTF(("TCP_Server: Accepting connection\n")); - if ((newsockfd = PR_Accept(sockfd, &netaddr, + if ((newsockfd = PR_Accept(sockfd, addrp, PR_INTERVAL_NO_TIMEOUT)) == NULL) { fprintf(stderr,"prsocket_test: ERROR - PR_Accept failed\n"); goto exit; @@ -1750,8 +1752,10 @@ TransmitFile_Server(void *arg) PR_PostSem(sp->addr_sem); for (i = 0; i < num_transmitfile_clients ; i++) { + /* test both null and non-null 'addr' argument to PR_Accept */ + PRNetAddr *addrp = (i%2 ? &netaddr: NULL); - if ((newsockfd = PR_Accept(sockfd, &netaddr, + if ((newsockfd = PR_Accept(sockfd, addrp, PR_INTERVAL_NO_TIMEOUT)) == NULL) { fprintf(stderr, "prsocket_test: ERROR - PR_Accept failed\n");