[Python-checkins] cpython (3.5): Issue #24732, #23834: Fix sock_accept_impl() on Windows

victor.stinner python-checkins at python.org
Mon Jul 27 23:39:30 CEST 2015


https://hg.python.org/cpython/rev/cd60eccaa331
changeset:   97092:cd60eccaa331
branch:      3.5
parent:      97090:d55bdd2dc45e
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Mon Jul 27 23:37:11 2015 +0200
summary:
  Issue #24732, #23834: Fix sock_accept_impl() on Windows

accept() returns INVALID_SOCKET on error, it's not necessary a negative number.

files:
  Modules/socketmodule.c |  5 +++++
  1 files changed, 5 insertions(+), 0 deletions(-)


diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2211,7 +2211,12 @@
 #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) */

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list