From 397b4c93cc71622817cb59b5f367d7cfe5303f57 Mon Sep 17 00:00:00 2001 From: Ali Farzanrad Date: Sun, 4 Dec 2022 11:08:51 +0000 Subject: [PATCH] always initialize cause before return as error --- io.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/io.c b/io.c index eb4b492..bb6d0e8 100644 --- a/io.c +++ b/io.c @@ -158,11 +158,10 @@ io_polln(struct io **iop, u_int n, struct io **rio, int timeout, char **cause) xfree(pfds); if (error == 0) { - if (timeout == 0) { + if (timeout == 0) errno = EAGAIN; - return (-1); - } - errno = ETIMEDOUT; + else + errno = ETIMEDOUT; } if (errno == EINTR)