summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/sem_test.c5
-rw-r--r--zix/sem.h2
2 files changed, 5 insertions, 2 deletions
diff --git a/test/sem_test.c b/test/sem_test.c
index 1399229..bcc4116 100644
--- a/test/sem_test.c
+++ b/test/sem_test.c
@@ -65,7 +65,10 @@ main(int argc, char** argv)
printf("Testing %u signals...\n", n_signals);
- zix_sem_init(&sem, 0);
+ if (zix_sem_init(&sem, 0)) {
+ fprintf(stderr, "Failed to create semaphore.\n");
+ return 1;
+ }
ZixThread reader_thread;
if (zix_thread_create(&reader_thread, 128, reader, NULL)) {
diff --git a/zix/sem.h b/zix/sem.h
index 48115d5..ef01767 100644
--- a/zix/sem.h
+++ b/zix/sem.h
@@ -101,7 +101,7 @@ static inline ZixStatus
zix_sem_init(ZixSem* sem, unsigned initial)
{
return semaphore_create(mach_task_self(), &sem->sem, SYNC_POLICY_FIFO, 0)
- ? ZIX_STATUS_SUCCESS : ZIX_STATUS_ERROR;
+ ? ZIX_STATUS_ERROR : ZIX_STATUS_SUCCESS;
}
static inline void