From 120e2c1335e9c5c2bfda5348af3d3ea05c0934ac Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 22 Aug 2012 15:02:51 +0200 Subject: [PATCH] darwin: fix return value of uv_sem_init() It should return 0 or -1, not the kernel status code. --- src/unix/thread.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/unix/thread.c b/src/unix/thread.c index aa637180..f85de1a4 100644 --- a/src/unix/thread.c +++ b/src/unix/thread.c @@ -170,7 +170,10 @@ void uv_once(uv_once_t* guard, void (*callback)(void)) { #if defined(__APPLE__) && defined(__MACH__) int uv_sem_init(uv_sem_t* sem, unsigned int value) { - return semaphore_create(mach_task_self(), sem, SYNC_POLICY_FIFO, value); + if (semaphore_create(mach_task_self(), sem, SYNC_POLICY_FIFO, value)) + return -1; + else + return 0; }