Skip to content
Snippets Groups Projects
Commit 891113da authored by Paul A. Patience's avatar Paul A. Patience
Browse files

sched/semaphore: Fix setting EINVAL in sem_post() and sem_wait()

parent d4408264
No related branches found
No related tags found
No related merge requests found
......@@ -41,6 +41,7 @@
#include <limits.h>
#include <semaphore.h>
#include <errno.h>
#include <sched.h>
#include <nuttx/irq.h>
......@@ -157,6 +158,10 @@ int sem_post(FAR sem_t *sem)
leave_critical_section(flags);
}
else
{
set_errno(EINVAL);
}
return ret;
}
......@@ -86,9 +86,7 @@ int sem_wait(FAR sem_t *sem)
DEBUGASSERT(up_interrupt_context() == false);
/* Assume any errors reported are due to invalid arguments. */
set_errno(EINVAL);
/* Make sure we were supplied with a valid semaphore. */
if (sem)
{
......@@ -190,6 +188,10 @@ int sem_wait(FAR sem_t *sem)
leave_critical_section(flags);
}
else
{
set_errno(EINVAL);
}
return ret;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment