summaryrefslogtreecommitdiff
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
authorCharles-François Natali <neologix@free.fr>2011-08-28 16:22:33 +0200
committerCharles-François Natali <neologix@free.fr>2011-08-28 16:22:33 +0200
commitfda7b379acde3ad60bbd42acb6da7e7099d25133 (patch)
tree8a6f41e799670ac5cea353e6cc4bc671fec25798 /Modules/socketmodule.c
parentbbabbae114f6d16dacdc1ad8f6f04b95fb6b17eb (diff)
downloadcpython-git-fda7b379acde3ad60bbd42acb6da7e7099d25133.tar.gz
Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is
greater than FD_SETSIZE.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 694259b244..279a09079a 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -456,18 +456,14 @@ static PyTypeObject sock_type;
#include <sys/poll.h>
#endif
-#ifdef Py_SOCKET_FD_CAN_BE_GE_FD_SETSIZE
-/* Platform can select file descriptors beyond FD_SETSIZE */
-#define IS_SELECTABLE(s) 1
-#elif defined(HAVE_POLL)
+#ifdef HAVE_POLL
/* Instead of select(), we'll use poll() since poll() works on any fd. */
#define IS_SELECTABLE(s) 1
/* Can we call select() with this socket without a buffer overrun? */
#else
-/* POSIX says selecting file descriptors beyond FD_SETSIZE
- has undefined behaviour. If there's no timeout left, we don't have to
- call select, so it's a safe, little white lie. */
-#define IS_SELECTABLE(s) ((s)->sock_fd < FD_SETSIZE || s->sock_timeout <= 0.0)
+/* If there's no timeout left, we don't have to call select, so it's a safe,
+ * little white lie. */
+#define IS_SELECTABLE(s) (_PyIsSelectable_fd((s)->sock_fd) || (s)->sock_timeout <= 0.0)
#endif
static PyObject*