summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>1999-01-08 22:24:14 +0000
committerwtc%netscape.com <devnull@localhost>1999-01-08 22:24:14 +0000
commit80a2883ee44ac4a0ad735f74ad2282c42613e5cf (patch)
tree673efbe2760791b5b5c665957e2e9575099412fd
parent406d0aea11fcc1582068c876c6465b7279e724c5 (diff)
downloadnspr-hg-80a2883ee44ac4a0ad735f74ad2282c42613e5cf.tar.gz
Bugzilla bug #2248: PR_ImportFile, PR_ImportTCPSocket, and
PR_ImportUDPSocket should initialize NSPR implicitly. Thanks to John McMullen <mcmullen@netscape.com> for the bug report and fix.
-rw-r--r--pr/src/io/prfile.c2
-rw-r--r--pr/src/io/prsocket.c2
-rw-r--r--pr/src/pthreads/ptio.c15
3 files changed, 16 insertions, 3 deletions
diff --git a/pr/src/io/prfile.c b/pr/src/io/prfile.c
index 54d0f558..173cec21 100644
--- a/pr/src/io/prfile.c
+++ b/pr/src/io/prfile.c
@@ -410,6 +410,8 @@ PR_IMPLEMENT(PRFileDesc*) PR_ImportFile(PRInt32 osfd)
{
PRFileDesc *fd = NULL;
+ if (!_pr_initialized) _PR_ImplicitInitialization();
+
fd = PR_AllocFileDesc(osfd, &_pr_fileMethods);
if( !fd ) {
(void) _PR_MD_CLOSE_FILE(osfd);
diff --git a/pr/src/io/prsocket.c b/pr/src/io/prsocket.c
index de6546c0..e93e0ec2 100644
--- a/pr/src/io/prsocket.c
+++ b/pr/src/io/prsocket.c
@@ -167,6 +167,7 @@ PR_IMPLEMENT(PRFileDesc *) PR_ImportTCPSocket(PRInt32 osfd)
{
PRFileDesc *fd;
+ if (!_pr_initialized) _PR_ImplicitInitialization();
fd = PR_AllocFileDesc(osfd, PR_GetTCPMethods());
if (fd != NULL)
_PR_MD_MAKE_NONBLOCK(fd);
@@ -179,6 +180,7 @@ PR_IMPLEMENT(PRFileDesc *) PR_ImportUDPSocket(PRInt32 osfd)
{
PRFileDesc *fd;
+ if (!_pr_initialized) _PR_ImplicitInitialization();
fd = PR_AllocFileDesc(osfd, PR_GetUDPMethods());
if (fd != NULL)
_PR_MD_MAKE_NONBLOCK(fd);
diff --git a/pr/src/pthreads/ptio.c b/pr/src/pthreads/ptio.c
index 658e0819..c6bd63be 100644
--- a/pr/src/pthreads/ptio.c
+++ b/pr/src/pthreads/ptio.c
@@ -3281,21 +3281,30 @@ PR_IMPLEMENT(PRStatus) PR_SetFDInheritable(
PR_IMPLEMENT(PRFileDesc*) PR_ImportFile(PRInt32 osfd)
{
- PRFileDesc *fd = pt_SetMethods(osfd, PR_DESC_FILE);
+ PRFileDesc *fd;
+
+ if (!_pr_initialized) _PR_ImplicitInitialization();
+ fd = pt_SetMethods(osfd, PR_DESC_FILE);
if (NULL == fd) close(osfd);
return fd;
} /* PR_ImportFile */
PR_IMPLEMENT(PRFileDesc*) PR_ImportTCPSocket(PRInt32 osfd)
{
- PRFileDesc *fd = pt_SetMethods(osfd, PR_DESC_SOCKET_TCP);
+ PRFileDesc *fd;
+
+ if (!_pr_initialized) _PR_ImplicitInitialization();
+ fd = pt_SetMethods(osfd, PR_DESC_SOCKET_TCP);
if (NULL == fd) close(osfd);
return fd;
} /* PR_ImportTCPSocket */
PR_IMPLEMENT(PRFileDesc*) PR_ImportUDPSocket(PRInt32 osfd)
{
- PRFileDesc *fd = pt_SetMethods(osfd, PR_DESC_SOCKET_UDP);
+ PRFileDesc *fd;
+
+ if (!_pr_initialized) _PR_ImplicitInitialization();
+ fd = pt_SetMethods(osfd, PR_DESC_SOCKET_UDP);
if (NULL != fd) close(osfd);
return fd;
} /* PR_ImportUDPSocket */