1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

safety measure to avoid using -1 as socket

This commit is contained in:
Daniel Stenberg 2005-04-18 08:49:46 +00:00
parent 9b391e531b
commit b62baaed95

View File

@ -288,10 +288,17 @@ static int juggle(curl_socket_t *sockfdp,
case PASSIVE_CONNECT: case PASSIVE_CONNECT:
sockfd = *sockfdp; sockfd = *sockfdp;
if(-1 == sockfd) {
/* eeek, we are supposedly connected and then this cannot be -1 ! */
logmsg("socket is -1! on %s:%d", __FILE__, __LINE__);
return FALSE;
}
else {
logmsg("waiting for data from client on socket %d", (int)sockfd); logmsg("waiting for data from client on socket %d", (int)sockfd);
/* there's always a socket to wait for */ /* there's always a socket to wait for */
FD_SET(sockfd, &fds_read); FD_SET(sockfd, &fds_read);
maxfd = sockfd; maxfd = sockfd;
}
break; break;
case ACTIVE: case ACTIVE: