mirror of
https://github.com/apache/nuttx.git
synced 2025-05-08 22:32:04 +08:00
pthread_conddestroy: Fix return value, if sem_getvalue fails
sem_getvalue returns ERROR and sets errno if it fails, we don't want to return OK in this case, we want to return the non-negated error number.
This commit is contained in:
parent
c3b2910178
commit
516d1c069a
@ -69,21 +69,18 @@ int pthread_cond_destroy(FAR pthread_cond_t *cond)
|
||||
|
||||
else
|
||||
{
|
||||
ret = sem_getvalue(&cond->sem, &sval);
|
||||
ret = nxsem_get_value(&cond->sem, &sval);
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -ret;
|
||||
}
|
||||
else if (sval < 0)
|
||||
{
|
||||
ret = EBUSY;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sval < 0)
|
||||
{
|
||||
ret = EBUSY;
|
||||
}
|
||||
else if (sem_destroy(&cond->sem) != OK)
|
||||
{
|
||||
ret = get_errno();
|
||||
}
|
||||
ret = -nxsem_destroy(&cond->sem);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user