mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #23618: Cleanup internal_connect() in socketmodule.c
On Windows, it looks like using the C type socklen_t for getsockopt() (instead of int) is fine, it was already used in socket.getsockopt().
This commit is contained in:
parent
41290a68ba
commit
c4e819a54f
1 changed files with 1 additions and 3 deletions
|
@ -2485,7 +2485,7 @@ internal_connect(PySocketSockObject *s, struct sockaddr *addr, int addrlen,
|
||||||
else if (timeout == 0) {
|
else if (timeout == 0) {
|
||||||
socklen_t res_size = sizeof res;
|
socklen_t res_size = sizeof res;
|
||||||
if (!getsockopt(s->sock_fd, SOL_SOCKET, SO_ERROR,
|
if (!getsockopt(s->sock_fd, SOL_SOCKET, SO_ERROR,
|
||||||
(char*)&res, &res_size)) {
|
(void *)&res, &res_size)) {
|
||||||
if (res == EISCONN)
|
if (res == EISCONN)
|
||||||
res = 0;
|
res = 0;
|
||||||
err = res;
|
err = res;
|
||||||
|
@ -2533,8 +2533,6 @@ sock_connect(PySocketSockObject *s, PyObject *addro)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
/* getsockopt also clears WSAGetLastError,
|
|
||||||
so reset it back. */
|
|
||||||
WSASetLastError(res);
|
WSASetLastError(res);
|
||||||
#else
|
#else
|
||||||
errno = res;
|
errno = res;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue