net/lwip: fix sem_tickwait error handleing
sem_tickwait API was changed however lwIP didn't apply changed API.
@@ -463,7 +463,6 @@ u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
int remaining_time;
if (timeout == 0) {
-
while (sem_wait(sem) != OK) {
/* Handle the special case where the semaphore wait was
* awakened by the receipt of a signal.
@@ -483,10 +482,13 @@ u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
* awakened by the receipt of a signal.
* Restart If signal is EINTR else break if ETIMEDOUT
*/
- if (status == -ECANCELED) {
- return SYS_ARCH_CANCELED;
- } else if (status == -ETIMEDOUT) {
+ int err_no = get_errno();
+ if (err_no == ETIMEDOUT) {
return SYS_ARCH_TIMEOUT;
+ } else if (err_no == ENOMEM) {
+ LWIP_ASSERT("status == ENOMEM", 0);
+ } else if (err_no == ECANCELED) {
+ return SYS_ARCH_CANCELED;
} else {
/* calculate remaining timeout */
remaining_time -= TICK2MSEC(clock_systimer() - start);
@@ -495,9 +497,7 @@ u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
}
}
}
-
}
-
clock_t end = clock_systimer();
return TICK2MSEC(end - start);
}
