From bea232a15fc818341217901772c7e622e9f9332d Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 27 Jul 2015 23:37:11 +0200 Subject: Issue #24732, #23834: Fix sock_accept_impl() on Windows accept() returns INVALID_SOCKET on error, it's not necessary a negative number. --- Modules/socketmodule.c | 5 +++++ 1 file changed, 5 insertions(+) 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) */ -- cgit v0.12