*addrlen = addrlen_temp; } else { _PR_MD_MAP_RECVFROM_ERROR(err);
if ((rv = socket_io_wait(osfd, READ_FD, timeout)) < 0) goto done; } else if ((err == SOCEINTR) && (!_PR_PENDING_INTERRUPT(me))){ continue; } else {
_PR_MD_RECVFROM(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags,                PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout){    PRInt32 osfd = fd->secret->md.osfd;    PRInt32 rv, err;    PRUint32 addrlen_temp = *addrlen;#ifdef BSD_SELECT    struct timeval tv, *tvp;    fd_set rd;#else    int socks[1];     long lTimeout = -1; #endif    while ((rv = recvfrom( osfd, (char *) buf, amount, 0, (struct sockaddr *) addr,            (int *) addrlen)) == -1)     {        if (((err = sock_errno()) == EWOULDBLOCK)             && (!fd->secret->nonblocking))        {#ifdef BSD_SELECT            if (timeout == PR_INTERVAL_NO_TIMEOUT)             {                tvp = NULL;            }             else             {                tv.tv_sec = PR_IntervalToSeconds(timeout);                tv.tv_usec = PR_IntervalToMicroseconds(                timeout - PR_SecondsToInterval(tv.tv_sec));                tvp = &tv;            }            FD_ZERO(&rd);            FD_SET(osfd, &rd);            if ((rv = _MD_SELECT(osfd + 1, &rd, NULL, NULL, tvp)) == -1) #else            if (timeout == PR_INTERVAL_NO_TIMEOUT)             {                lTimeout = -1;            }             else             {                lTimeout = PR_IntervalToMilliseconds(timeout);              }            socks[0] = osfd;             if ((rv = _MD_SELECT(socks, 1, 0, 0, lTimeout)) == -1) #endif            {                _PR_MD_MAP_SELECT_ERROR(sock_errno());                return -1;            } else if (rv == 0)             {                PR_SetError(PR_IO_TIMEOUT_ERROR, 0);                rv = -1;                break;            }            /* recvfrom blows this value away if it fails first time */            *addrlen = addrlen_temp;        }         else         {            _PR_MD_MAP_RECVFROM_ERROR(err);            break;        }    }    return(rv);}