From 0b1b0bcb56ad20be178e1fdcf862481cc8b1f764 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Mon, 23 Jan 2023 01:53:36 +0100 Subject: [PATCH] Update async_check to check return value of poll() --- src/async.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/async.c b/src/async.c index fbb010a..c29aef6 100644 --- a/src/async.c +++ b/src/async.c @@ -136,10 +136,15 @@ static int async_check(evt_listen_t *evt) { }}; // check, if fd is already ready - if (poll(fds, 1, 0) == 1) { - // fd already ready - if (async_exec(evt, async_p2a(fds[0].revents)) == 0) - return 1; + switch (poll(fds, 1, 0)) { + case 1: + // fd already ready + if (async_exec(evt, async_p2a(fds[0].revents)) == 0) + return 1; + break; + case -1: + error("Unable to poll"); + return -1; } return 0;