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; }