summaryrefslogtreecommitdiffstatshomepage
path: root/unix
diff options
context:
space:
mode:
Diffstat (limited to 'unix')
-rw-r--r--unix/moduselect.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/unix/moduselect.c b/unix/moduselect.c
index 645e0545d4..80483043bd 100644
--- a/unix/moduselect.c
+++ b/unix/moduselect.c
@@ -58,7 +58,15 @@ STATIC mp_obj_t poll_register(uint n_args, const mp_obj_t *args) {
if (self->len < self->alloc) {
i = self->len++;
} else {
- assert(0);
+ struct pollfd *entries = self->entries;
+ for (i = 0; i < self->len; i++, entries++) {
+ if (entries->fd == -1) {
+ break;
+ }
+ }
+ if (entries->fd != -1) {
+ assert(0);
+ }
}
self->entries[i].fd = mp_obj_get_int(args[1]);