darwin: fix return value of uv_sem_init()

It should return 0 or -1, not the kernel status code.
This commit is contained in:
Ben Noordhuis 2012-08-22 15:02:51 +02:00
parent 8969df6015
commit 120e2c1335

View File

@ -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;
}