From 9b5e0ee59220e490d40aac6d53ad1ec5714a6ff1 Mon Sep 17 00:00:00 2001 From: bptato Date: Thu, 26 Sep 2024 23:59:57 +0200 Subject: poll: unset unused fds in register --- src/io/poll.nim | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') 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 -- cgit 1.4.1-2-gfad0