mirror of
https://github.com/curl/curl.git
synced 2026-06-17 02:35:38 +03:00
fixup cf-socket to check errno only when the callback is not used
This commit is contained in:
parent
5c85b0dbf7
commit
0f608a3b76
1 changed files with 3 additions and 2 deletions
|
|
@ -346,14 +346,15 @@ static CURLcode socket_open(struct Curl_easy *data,
|
|||
else {
|
||||
/* opensocket callback not set, so simply create the socket now */
|
||||
*sockfd = CURL_SOCKET(addr->family, addr->socktype, addr->protocol);
|
||||
if((*sockfd == CURL_SOCKET_BAD) && (SOCKERRNO == SOCKENOMEM))
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if(*sockfd == CURL_SOCKET_BAD) {
|
||||
/* no socket, no connection */
|
||||
failf(data, "failed to open socket: %s",
|
||||
curlx_strerror(SOCKERRNO, errbuf, sizeof(errbuf)));
|
||||
return SOCKERRNO == SOCKENOMEM ? CURLE_OUT_OF_MEMORY :
|
||||
CURLE_COULDNT_CONNECT;
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
|
||||
#ifdef HAVE_FCNTL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue