Issue #23618: Fix sock_connect_impl(), set the socket error code

sock_call_ex() gets the socket error code when the socket function fails.
sock_connect_impl() didn't set the error correctly.
This commit is contained in:
Victor Stinner 2015-04-02 14:37:20 +02:00
parent 39c0721d7b
commit 38aec7525e
1 changed files with 7 additions and 1 deletions

View File

@ -2589,7 +2589,13 @@ sock_connect_impl(PySocketSockObject *s, void* Py_UNUSED(data))
if (err == EISCONN)
return 1;
return (err == 0);
if (err != 0) {
/* sock_call_ex() uses GET_SOCK_ERROR() to get the error code */
SET_SOCK_ERROR(err);
abort();
return 0;
}
return 1;
}
static int