Fix net_lock returning ERROR when instead of real error code on failure.
This commit is contained in:
parent
afe137ffbf
commit
5beaad491a
|
@ -232,6 +232,16 @@ int net_timedwait(sem_t *sem, FAR const struct timespec *abstime)
|
|||
ret = sem_wait(sem);
|
||||
}
|
||||
|
||||
/* Check for errors from sem_wait() (should only be EINTR)
|
||||
* REVISIT: errno really should not be used within the OS
|
||||
*/
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -get_errno();
|
||||
DEBUGASSERT(ret < 0);
|
||||
}
|
||||
|
||||
/* Recover the network lock at the proper count */
|
||||
|
||||
_net_takesem();
|
||||
|
@ -241,15 +251,18 @@ int net_timedwait(sem_t *sem, FAR const struct timespec *abstime)
|
|||
else
|
||||
{
|
||||
ret = sem_wait(sem);
|
||||
|
||||
/* Check for errors from sem_wait() (should only be EINTR)
|
||||
* REVISIT: errno really should not be used within the OS
|
||||
*/
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -get_errno();
|
||||
DEBUGASSERT(ret < 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* REVISIT: errno really should not be used within the OS */
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -get_errno();
|
||||
DEBUGASSERT(ret < 0);
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
|
|
Loading…
Reference in New Issue