aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnders Bakken <agbakken@gmail.com>2015-11-16 12:50:41 -0800
committerDaniel Stenberg <daniel@haxx.se>2015-11-16 22:42:13 +0100
commita72207ecf039e4c36abeaf64ba00ef36522f3f73 (patch)
tree9806926e4cbd8649f0de2549852ed991ffa07e50 /lib
parent6c5f4303fe531f2b8772cedfe275b8bbe839ab4b (diff)
getconnectinfo: Don't call recv(2) if socket == -1
Closes #528
Diffstat (limited to 'lib')
-rw-r--r--lib/connect.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/connect.c b/lib/connect.c
index ece6cf3f6..88041dd80 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -1242,10 +1242,10 @@ curl_socket_t Curl_getconnectinfo(struct SessionHandle *data,
}
/* Minix 3.1 doesn't support any flags on recv; just assume socket is OK */
#ifdef MSG_PEEK
- else {
+ else if(sockfd != CURL_SOCKET_BAD) {
/* use the socket */
char buf;
- if(recv((RECV_TYPE_ARG1)c->sock[FIRSTSOCKET], (RECV_TYPE_ARG2)&buf,
+ if(recv((RECV_TYPE_ARG1)sockfd, (RECV_TYPE_ARG2)&buf,
(RECV_TYPE_ARG3)1, (RECV_TYPE_ARG4)MSG_PEEK) == 0) {
return CURL_SOCKET_BAD; /* FIN received */
}