lib: posix: Return errno code
Return EINVAL errno when argument doesn't refer to valid semaphore. partly fixes #9993 Signed-off-by: Punit Vara <punit.vara@intel.com>
This commit is contained in:
parent
bdd1b3897b
commit
2cf270758e
|
@ -35,7 +35,13 @@ int sem_destroy(sem_t *semaphore)
|
|||
*/
|
||||
int sem_getvalue(sem_t *semaphore, int *value)
|
||||
{
|
||||
if (semaphore == NULL) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
*value = (int) k_sem_count_get(semaphore);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue