From: Felix Fietkau Date: Wed, 8 Mar 2023 08:38:53 +0000 (+0100) Subject: usock: fix poll return code check X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=ef5e8e38bd38f26e2da2f6f0a2d720468c935280;p=project%2Flibubox.git usock: fix poll return code check errno needs to be compared against EINTR/EAGAIN instead of the return code, and only if the return code is < 0. Signed-off-by: Felix Fietkau --- diff --git a/usock.c b/usock.c index 0ce5390..15b6988 100644 --- a/usock.c +++ b/usock.c @@ -120,10 +120,7 @@ static int poll_restart(struct pollfd *fds, int nfds, int timeout) while (1) { ret = poll(fds, nfds, timeout); - if (ret == EAGAIN) - continue; - - if (ret != EINTR) + if (ret >= 0 || (errno != EINTR && errno != EAGAIN)) return ret; clock_gettime(CLOCK_MONOTONIC, &cur);