mirror of
https://github.com/curl/curl.git
synced 2025-09-28 06:56:50 +03:00
singleipconnect: don't clobber errno
Save the errno value immediately after a connect() failure so that it won't get reset to something else before we read it. Bug: http://curl.haxx.se/mail/lib-2011-10/0066.html Reported by: Frank Van Uffelen and Fabian Hiernaux
This commit is contained in:
parent
54ef47a5a0
commit
1a416cd27a
|
@ -836,7 +836,7 @@ singleipconnect(struct connectdata *conn,
|
||||||
{
|
{
|
||||||
struct Curl_sockaddr_ex addr;
|
struct Curl_sockaddr_ex addr;
|
||||||
int rc;
|
int rc;
|
||||||
int error;
|
int error = 0;
|
||||||
bool isconnected = FALSE;
|
bool isconnected = FALSE;
|
||||||
struct SessionHandle *data = conn->data;
|
struct SessionHandle *data = conn->data;
|
||||||
curl_socket_t sockfd;
|
curl_socket_t sockfd;
|
||||||
|
@ -946,6 +946,8 @@ singleipconnect(struct connectdata *conn,
|
||||||
/* Connect TCP sockets, bind UDP */
|
/* Connect TCP sockets, bind UDP */
|
||||||
if(!isconnected && (conn->socktype == SOCK_STREAM)) {
|
if(!isconnected && (conn->socktype == SOCK_STREAM)) {
|
||||||
rc = connect(sockfd, &addr.sa_addr, addr.addrlen);
|
rc = connect(sockfd, &addr.sa_addr, addr.addrlen);
|
||||||
|
if(-1 == rc)
|
||||||
|
error = SOCKERRNO;
|
||||||
conn->connecttime = Curl_tvnow();
|
conn->connecttime = Curl_tvnow();
|
||||||
if(conn->num_addr > 1)
|
if(conn->num_addr > 1)
|
||||||
Curl_expire(data, conn->timeoutms_per_addr);
|
Curl_expire(data, conn->timeoutms_per_addr);
|
||||||
|
@ -954,8 +956,6 @@ singleipconnect(struct connectdata *conn,
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
||||||
if(-1 == rc) {
|
if(-1 == rc) {
|
||||||
error = SOCKERRNO;
|
|
||||||
|
|
||||||
switch (error) {
|
switch (error) {
|
||||||
case EINPROGRESS:
|
case EINPROGRESS:
|
||||||
case EWOULDBLOCK:
|
case EWOULDBLOCK:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user