]> granicus.if.org Git - curl/commitdiff
oops, serious breakage in the fdset() function
authorDaniel Stenberg <daniel@haxx.se>
Fri, 9 Jun 2006 07:08:34 +0000 (07:08 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 9 Jun 2006 07:08:34 +0000 (07:08 +0000)
lib/transfer.c

index bb43c4da922dac3f14f1a3ff487b4496454d6dee..4aa94364b5097dc351b5d645523494a6ab621ae0 100644 (file)
@@ -1570,11 +1570,12 @@ int Curl_single_getsock(struct connectdata *conn,
   }
   if(conn->keep.keepon & KEEP_WRITE) {
 
-    if((conn->sockfd != conn->writesockfd) &&
-       (conn->keep.keepon & KEEP_READ)) {
-      /* only if they are not the same socket and we had a readable one,
-         we increase index */
-      index++;
+    if((conn->sockfd != conn->writesockfd) ||
+       !(conn->keep.keepon & KEEP_READ)) {
+      /* only if they are not the same socket or we didn't have a readable
+         one, we increase index */
+      if(conn->keep.keepon & KEEP_READ)
+        index++; /* increase index if we need two entries */
       sock[index] = conn->writesockfd;
     }