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>
while (1) {
ret = poll(fds, nfds, 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);
return ret;
clock_gettime(CLOCK_MONOTONIC, &cur);