summaryrefslogtreecommitdiffstats
path: root/Modules/_multiprocessing/socket_connection.c
diff options
context:
space:
mode:
authorJesse Noller <jnoller@gmail.com>2009-01-19 16:23:53 (GMT)
committerJesse Noller <jnoller@gmail.com>2009-01-19 16:23:53 (GMT)
commit6214edd1bbf8aece44215b6a47fb2be4df73d42e (patch)
tree29c89e73cfb551883794d0c9922dd566b3864b60 /Modules/_multiprocessing/socket_connection.c
parent7aedf11e57bf38e992ebe6c0ae86167ae9b79412 (diff)
downloadcpython-6214edd1bbf8aece44215b6a47fb2be4df73d42e.zip
cpython-6214edd1bbf8aece44215b6a47fb2be4df73d42e.tar.gz
cpython-6214edd1bbf8aece44215b6a47fb2be4df73d42e.tar.bz2
merge r68768 to py3k
Diffstat (limited to 'Modules/_multiprocessing/socket_connection.c')
-rw-r--r--Modules/_multiprocessing/socket_connection.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/Modules/_multiprocessing/socket_connection.c b/Modules/_multiprocessing/socket_connection.c
index e5d2d15..ad4005b 100644
--- a/Modules/_multiprocessing/socket_connection.c
+++ b/Modules/_multiprocessing/socket_connection.c
@@ -153,11 +153,23 @@ conn_recv_string(ConnectionObject *conn, char *buffer,
*/
static int
-conn_poll(ConnectionObject *conn, double timeout)
+conn_poll(ConnectionObject *conn, double timeout, PyThreadState *_save)
{
int res;
fd_set rfds;
+ /*
+ * Verify the handle, issue 3321. Not required for windows.
+ */
+ #ifndef MS_WINDOWS
+ if (((int)conn->handle) < 0 || ((int)conn->handle) >= FD_SETSIZE) {
+ Py_BLOCK_THREADS
+ PyErr_SetString(PyExc_IOError, "handle out of range in select()");
+ Py_UNBLOCK_THREADS
+ return MP_EXCEPTION_HAS_BEEN_SET;
+ }
+ #endif
+
FD_ZERO(&rfds);
FD_SET((SOCKET)conn->handle, &rfds);