summaryrefslogtreecommitdiff
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-04-02 14:37:20 +0200
committerVictor Stinner <victor.stinner@gmail.com>2015-04-02 14:37:20 +0200
commit38aec7525eb22d2ea0090be610d6ababb4c8882f (patch)
tree5733f15a509ca0434858ec831c2dd0a2ab260bcf /Modules/socketmodule.c
parent39c0721d7b1872845e1cbb39bbb00eb23571d7c7 (diff)
downloadcpython-git-38aec7525eb22d2ea0090be610d6ababb4c8882f.tar.gz
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.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index d9fa04d0d6..81e9cc908f 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -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