about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/io/poll.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/io/poll.nim b/src/io/poll.nim
index fe7aee56..5e115a11 100644
--- a/src/io/poll.nim
+++ b/src/io/poll.nim
@@ -42,6 +42,10 @@ proc poll*(ctx: var PollData; timeout: cint) =
   ctx.trim()
   let fds = addr ctx.fds[0]
   let nfds = cint(ctx.fds.len)
+  var res: cint
   {.emit: """
-  poll(`fds`, `nfds`, `timeout`);
+  `res` = (int)poll(`fds`, `nfds`, `timeout`);
   """.}
+  if res < 0: # error
+    for event in ctx.fds.mitems:
+      event.revents = 0