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
This commit is contained in:
Martin Lucina 2010-09-04 16:24:21 +02:00
commit ca176121de
3 changed files with 10 additions and 2 deletions

View File

@ -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 */

View File

@ -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);

View File

@ -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++) {