lwip: sys_arch_sem_wait, fix wrong process of sem_tickwait error case
This patch fixes problems as follows:
- sys_arch_sem_wait uses errno for processing of errcase of sem_tickwait.
- But sem_tickwait does not set errno when error happens.
@@ -469,15 +469,14 @@ u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
}
status = OK;
} else {
- while (sem_tickwait(sem, clock_systimer(), MSEC2TICK(timeout)) != OK) {
+ while ((status = sem_tickwait(sem, clock_systimer(), MSEC2TICK(timeout))) != OK) {
/* Handle the special case where the semaphore wait was
* awakened by the receipt of a signal.
* Restart If signal is EINTR else break if ETIMEDOUT
*/
- status = get_errno();
- if (status == ECANCELED) {
+ if (status == -ECANCELED) {
return SYS_ARCH_CANCELED;
- } else if (status == ETIMEDOUT) {
+ } else if (status == -ETIMEDOUT) {
return SYS_ARCH_TIMEOUT;
} else {
/* calculate remaining timeout */
