about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/io/poll.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/io/poll.nim b/src/io/poll.nim
index f394233e..fe7aee56 100644
--- a/src/io/poll.nim
+++ b/src/io/poll.nim
@@ -14,7 +14,10 @@ iterator events*(ctx: PollData): TPollFd =
 
 proc register*(ctx: var PollData; fd: int; events: cshort) =
   if fd >= ctx.fds.len:
+    let olen = ctx.fds.len
     ctx.fds.setLen(fd + 1)
+    for i in olen ..< fd:
+      ctx.fds[i].fd = -1
   ctx.fds[fd].fd = cint(fd)
   ctx.fds[fd].events = events