Skip to content

Commit

Permalink
pthread_barrier_destroy: Fix return value, if sem_getvalue fails
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pussuw committed Jan 16, 2025
1 parent ddc42f3 commit 1884279
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/libc/pthread/pthread_barrierdestroy.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ int pthread_barrier_destroy(FAR pthread_barrier_t *barrier)
else
{
ret = sem_getvalue(&barrier->sem, &semcount);
if (ret != OK)
if (ret < 0)
{
return ret;
return get_errno();
}

if (semcount < 0)
Expand Down

0 comments on commit 1884279

Please sign in to comment.