From 38aec7525eb22d2ea0090be610d6ababb4c8882f Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 2 Apr 2015 14:37:20 +0200 Subject: 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. --- Modules/socketmodule.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index d9fa04d..81e9cc9 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 -- cgit v0.12