summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-07-27 21:37:11 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-07-27 21:37:11 (GMT)
commitbea232a15fc818341217901772c7e622e9f9332d (patch)
treec53ef76ea843968d63c3bdf8563a4f731441cf57 /Modules
parent0659c43d73e5d9ce4540c53f76b66ddb904be6de (diff)
downloadcpython-bea232a15fc818341217901772c7e622e9f9332d.zip
cpython-bea232a15fc818341217901772c7e622e9f9332d.tar.gz
cpython-bea232a15fc818341217901772c7e622e9f9332d.tar.bz2
Issue #24732, #23834: Fix sock_accept_impl() on Windows
accept() returns INVALID_SOCKET on error, it's not necessary a negative number.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/socketmodule.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 7610b0c..ee24907 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2211,7 +2211,12 @@ sock_accept_impl(PySocketSockObject *s, void *data)
#else
ctx->result = accept(s->sock_fd, SAS2SA(ctx->addrbuf), ctx->addrlen);
#endif
+
+#ifdef MS_WINDOWS
+ return (ctx->result != INVALID_SOCKET);
+#else
return (ctx->result >= 0);
+#endif
}
/* s._accept() -> (fd, address) */