diff --git a/src/iomux_select.c b/src/iomux_select.c index fb1517a..bdf0029 100644 --- a/src/iomux_select.c +++ b/src/iomux_select.c @@ -27,15 +27,14 @@ static int iomux_select_update_events(struct IOMux *mux_, struct IOMuxFD *fd); static void iomux_select_recalc_max(struct IOMuxSelect *mux) { size_t i; + size_t n; mux->max_fd = -1; - for (i = 0; i < mux->num_descriptors; ) { + for (i = 0, n = 0; i < FD_SETSIZE && n < mux->num_descriptors; i++) { if (mux->descriptors[i] != NULL) { mux->max_fd = UC_MAX(mux->descriptors[i]->fd, mux->max_fd); - i++; + n++; } - - assert(i < FD_SETSIZE); } }