Commit 19920e25 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

unix/moduselect: Fix bug in poll.poll() scanning loop.

parent 0786716c
...@@ -130,13 +130,12 @@ STATIC mp_obj_t poll_poll(uint n_args, const mp_obj_t *args) { ...@@ -130,13 +130,12 @@ STATIC mp_obj_t poll_poll(uint n_args, const mp_obj_t *args) {
mp_obj_list_t *ret_list = mp_obj_new_list(n_ready, NULL); mp_obj_list_t *ret_list = mp_obj_new_list(n_ready, NULL);
int ret_i = 0; int ret_i = 0;
struct pollfd *entries = self->entries; struct pollfd *entries = self->entries;
for (int i = 0; i < self->len; i++) { for (int i = 0; i < self->len; i++, entries++) {
if (entries->revents != 0) { if (entries->revents != 0) {
mp_obj_tuple_t *t = mp_obj_new_tuple(2, NULL); mp_obj_tuple_t *t = mp_obj_new_tuple(2, NULL);
t->items[0] = MP_OBJ_NEW_SMALL_INT(entries->fd); t->items[0] = MP_OBJ_NEW_SMALL_INT(entries->fd);
t->items[1] = MP_OBJ_NEW_SMALL_INT(entries->revents); t->items[1] = MP_OBJ_NEW_SMALL_INT(entries->revents);
ret_list->items[ret_i++] = t; ret_list->items[ret_i++] = t;
entries++;
} }
} }
......
Supports Markdown
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