diff options
author | Felix Fietkau <nbd@nbd.name> | 2023-03-08 09:38:53 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2023-03-08 09:38:55 +0100 |
commit | ef5e8e38bd38f26e2da2f6f0a2d720468c935280 (patch) | |
tree | e7f226a4eddfc2713f275c88fcb1d285beac8de5 | |
parent | eac92a4d5d82eb31e712157e7eb425af728b2c43 (diff) | |
download | libubox-ef5e8e38bd38f26e2da2f6f0a2d720468c935280.tar.gz |
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 <nbd@nbd.name>
-rw-r--r-- | usock.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -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); |