diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-04-02 14:37:20 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-04-02 14:37:20 +0200 |
commit | 38aec7525eb22d2ea0090be610d6ababb4c8882f (patch) | |
tree | 5733f15a509ca0434858ec831c2dd0a2ab260bcf /Modules | |
parent | 39c0721d7b1872845e1cbb39bbb00eb23571d7c7 (diff) | |
download | cpython-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')
-rw-r--r-- | Modules/socketmodule.c | 8 |
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 |