From f3282f8123146f427aaaafd981bfb75177f3f960 Mon Sep 17 00:00:00 2001 From: "Martine S. Lenders" Date: Wed, 1 Jul 2020 17:52:58 +0200 Subject: [PATCH] fixup! posix_select: initial import of `select()` function --- sys/posix/select/posix_select.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/posix/select/posix_select.c b/sys/posix/select/posix_select.c index 87c11e3cd941..2bf3ed8535e8 100644 --- a/sys/posix/select/posix_select.c +++ b/sys/posix/select/posix_select.c @@ -117,13 +117,13 @@ int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, while (wait) { if (_set_timeout(&timeout_timer, timeout, xtimer_now_usec() - start_time, &wait) < 0) { - fds_set = -1; - goto end; + /* timeout setting failed so not set, so no need to go to end */ + return -1; } if (!wait) { /* timeout was reached, timeout was not set, so no need to * go to end */ - errno = -EINTR; + errno = EINTR; return -1; } thread_flags_t tflags = thread_flags_wait_any(POSIX_SELECT_THREAD_FLAG | @@ -140,7 +140,7 @@ int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, } } else if (tflags & THREAD_FLAG_TIMEOUT) { - errno = -EINTR; + errno = EINTR; /* timeout fired, so no need to go to end */ return -1; }