sockopt.option = PR_SockOpt_Nonblocking; err = PR_GetSocketOption(cmSock->fd, &sockopt); PR_ASSERT(PR_SUCCESS == err);  nonBlocking = sockopt.value.non_blocking;   sockopt.option = PR_SockOpt_Nonblocking; sockopt.value.non_blocking = PR_FALSE; err = PR_SetSocketOption(cmSock->fd, &sockopt); PR_ASSERT(PR_SUCCESS == err);
nsPSMShimConnect(CMTSocket sock, short port, char *path){    CMTStatus   rv = CMTSuccess;    PRStatus    err;    PRErrorCode errcode;    CMSocket    *cmSock = (CMSocket *)sock;        if (!sock) return CMTFailure;    if (cmSock->isUnix)    {#ifndef XP_UNIX        return CMTFailure;#else        int pathLen;        if (!path)        {            return CMTFailure;        }        /* check buffer overrun */        pathLen = strlen(path)+1;                pathLen = pathLen < sizeof(cmSock->netAddr.local.path)                ? pathLen : sizeof(cmSock->netAddr.local.path);          memcpy(&cmSock->netAddr.local.path, path, pathLen);        cmSock->netAddr.local.family = PR_AF_LOCAL;#endif    }    else  /* cmSock->isUnix */    {        cmSock->netAddr.inet.family = PR_AF_INET;        cmSock->netAddr.inet.port   = PR_htons(port);        cmSock->netAddr.inet.ip     = PR_htonl(PR_INADDR_LOOPBACK);    }        err = PR_Connect( cmSock->fd, &cmSock->netAddr, PR_INTERVAL_MAX );        if (err == PR_FAILURE)        {        errcode = PR_GetError();                if (PR_IS_CONNECTED_ERROR != errcode)            rv = CMTFailure;    }            return rv;}