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. git-svn-id: svn://10.0.0.236/trunk@17393 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user