aboutsummaryrefslogtreecommitdiff
path: root/tests/server
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-04-18 08:49:46 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-04-18 08:49:46 +0000
commitb62baaed959e52c9dc442c73cb85e2bb0d4d97a9 (patch)
tree727b1914f4a9a807a327b4a01bfdf41e5c3aad93 /tests/server
parent9b391e531b601b946ddc6579ec551fb59efc45f2 (diff)
safety measure to avoid using -1 as socket
Diffstat (limited to 'tests/server')
-rw-r--r--tests/server/sockfilt.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c
index 07c81b11d..5cbf045e7 100644
--- a/tests/server/sockfilt.c
+++ b/tests/server/sockfilt.c
@@ -288,10 +288,17 @@ static int juggle(curl_socket_t *sockfdp,
case PASSIVE_CONNECT:
sockfd = *sockfdp;
- logmsg("waiting for data from client on socket %d", (int)sockfd);
- /* there's always a socket to wait for */
- FD_SET(sockfd, &fds_read);
- maxfd = sockfd;
+ 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);
+ /* there's always a socket to wait for */
+ FD_SET(sockfd, &fds_read);
+ maxfd = sockfd;
+ }
break;
case ACTIVE: