diff --git a/lib/transfer.c b/lib/transfer.c index 6bf95c576..131f2dc7c 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -2021,7 +2021,8 @@ Curl_setup_transfer( if(conn->bits.multiplex || conn->httpversion == 20) { /* when multiplexing, the read/write sockets need to be the same! */ conn->sockfd = sockindex == -1 ? - conn->sock[writesockindex] : conn->sock[sockindex]; + ((writesockindex == -1 ? CURL_SOCKET_BAD : conn->sock[writesockindex])) : + conn->sock[sockindex]; conn->writesockfd = conn->sockfd; } else {