summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/zmq.h4
-rw-r--r--src/select.cpp4
-rw-r--r--src/zmq.cpp4
3 files changed, 10 insertions, 2 deletions
diff --git a/include/zmq.h b/include/zmq.h
index 075ff3c..26c6a1e 100644
--- a/include/zmq.h
+++ b/include/zmq.h
@@ -42,13 +42,13 @@ extern "C" {
#endif
/******************************************************************************/
-/* 0MQ versioning support. */
+/* 0MQ versioning support. */
/******************************************************************************/
ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch);
/******************************************************************************/
-// 0MQ errors.
+/* 0MQ errors. */
/******************************************************************************/
/* A number random anough not to collide with different errno ranges on */
diff --git a/src/select.cpp b/src/select.cpp
index 7345cbb..59eb83e 100644
--- a/src/select.cpp
+++ b/src/select.cpp
@@ -65,6 +65,10 @@ zmq::select_t::handle_t zmq::select_t::add_fd (fd_t fd_, i_poll_events *events_)
fd_entry_t entry = {fd_, events_};
fds.push_back (entry);
+ // Ensure we do not attempt to select () on more than FD_SETSIZE
+ // file descriptors.
+ zmq_assert (fds.size () <= FD_SETSIZE);
+
// Start polling on errors.
FD_SET (fd_, &source_set_err);
diff --git a/src/zmq.cpp b/src/zmq.cpp
index 6cf230c..736f764 100644
--- a/src/zmq.cpp
+++ b/src/zmq.cpp
@@ -491,6 +491,10 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
zmq::fd_t maxfd = 0;
+ // Ensure we do not attempt to select () on more than FD_SETSIZE
+ // file descriptors.
+ zmq_assert (nitems_ <= FD_SETSIZE);
+
// Build the fd_sets for passing to select ().
for (int i = 0; i != nitems_; i++) {