]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
PySocketSock_connect_ex(): On Windows, return the correct Windows exit
authorTim Peters <tim.peters@gmail.com>
Tue, 30 Oct 2001 01:26:49 +0000 (01:26 +0000)
committerTim Peters <tim.peters@gmail.com>
Tue, 30 Oct 2001 01:26:49 +0000 (01:26 +0000)
code.  The patch is from Jeremy, and allows test_asynchat to run again.
Bugfix candidate.

Modules/socketmodule.c

index f1b68c944374b0a797b7dc575116a8d5ee6b709e..e5d850cb3bc87157b466998767450228278b25b7 100644 (file)
@@ -1267,8 +1267,13 @@ PySocketSock_connect_ex(PySocketSockObject *s, PyObject *addro)
        Py_BEGIN_ALLOW_THREADS
        res = connect(s->sock_fd, addr, addrlen);
        Py_END_ALLOW_THREADS
-       if (res != 0)
+       if (res != 0) {
+#ifdef MS_WINDOWS
+               res = WSAGetLastError();
+#else
                res = errno;
+#endif
+       }
        return PyInt_FromLong((long) res);
 }