From c11c249e8f6290dcbbbf44b76deae97931f18dba Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 8 Oct 2017 12:25:58 -0600 Subject: [PATCH] Fix some compile problems in last commits when debug assertions are enabled. --- libc/misc/lib_filesem.c | 4 +++- libc/misc/lib_streamsem.c | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libc/misc/lib_filesem.c b/libc/misc/lib_filesem.c index f8258450d3..ff51e009f0 100644 --- a/libc/misc/lib_filesem.c +++ b/libc/misc/lib_filesem.c @@ -79,6 +79,7 @@ void lib_sem_initialize(FAR struct file_struct *stream) void lib_take_semaphore(FAR struct file_struct *stream) { pid_t my_pid = getpid(); + int ret; /* Do I already have the semaphore? */ @@ -92,13 +93,14 @@ void lib_take_semaphore(FAR struct file_struct *stream) { /* Take the semaphore (perhaps waiting) */ - while (_SEM_WAIT(&stream->fs_sem) < 0) + while ((ret = _SEM_WAIT(&stream->fs_sem)) < 0) { /* The only case that an error should occr here is if the wait * was awakened by a signal. */ DEBUGASSERT(_SEM_ERRNO(ret) == EINTR); + UNUSED(ret); } /* We have it. Claim the stak and return */ diff --git a/libc/misc/lib_streamsem.c b/libc/misc/lib_streamsem.c index 407c8ac22d..6bfb1d1a6a 100644 --- a/libc/misc/lib_streamsem.c +++ b/libc/misc/lib_streamsem.c @@ -56,15 +56,18 @@ void stream_semtake(FAR struct streamlist *list) { + int ret; + /* Take the semaphore (perhaps waiting) */ - while (_SEM_WAIT(&list->sl_sem) != 0) + while ((ret = _SEM_WAIT(&list->sl_sem)) < 0) { /* The only case that an error should occr here is if * the wait was awakened by a signal. */ DEBUGASSERT(_SEM_ERRNO(ret) == EINTR); + UNUSED(ret); } }