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:
Punit Vara 2018-10-15 15:43:45 +05:30 committed by Anas Nashif
parent bdd1b3897b
commit 2cf270758e

View file

@ -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;
}
/**