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>
This commit is contained in:
parent
eac92a4d5d
commit
ef5e8e38bd
1 changed files with 1 additions and 4 deletions
5
usock.c
5
usock.c
|
@ -120,10 +120,7 @@ static int poll_restart(struct pollfd *fds, int nfds, int timeout)
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
ret = poll(fds, nfds, timeout);
|
ret = poll(fds, nfds, timeout);
|
||||||
if (ret == EAGAIN)
|
if (ret >= 0 || (errno != EINTR && errno != EAGAIN))
|
||||||
continue;
|
|
||||||
|
|
||||||
if (ret != EINTR)
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &cur);
|
clock_gettime(CLOCK_MONOTONIC, &cur);
|
||||||
|
|
Loading…
Reference in a new issue