Commit ca176121 authored by Martin Lucina's avatar Martin Lucina

Merge branch 'maint'

* maint:
  zmq::select_t, zmq_poll(): assert if FD_SETSIZE reached
  zmq.h: Fix typo and use of C99 comment

Conflicts:
	src/zmq.cpp
parents 2673a84e 51a84c15
...@@ -48,7 +48,7 @@ extern "C" { ...@@ -48,7 +48,7 @@ extern "C" {
ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch); 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 */ /* A number random anough not to collide with different errno ranges on */
......
...@@ -65,6 +65,10 @@ zmq::select_t::handle_t zmq::select_t::add_fd (fd_t fd_, i_poll_events *events_) ...@@ -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_}; fd_entry_t entry = {fd_, events_};
fds.push_back (entry); 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. // Start polling on errors.
FD_SET (fd_, &source_set_err); FD_SET (fd_, &source_set_err);
......
...@@ -491,6 +491,10 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) ...@@ -491,6 +491,10 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
zmq::fd_t maxfd = 0; 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 (). // Build the fd_sets for passing to select ().
for (int i = 0; i != nitems_; i++) { for (int i = 0; i != nitems_; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment