sem_open should make process-shared semaphores
authorRich Felker <dalias@aerifal.cx>
Sat, 29 Sep 2012 20:49:32 +0000 (16:49 -0400)
committerRich Felker <dalias@aerifal.cx>
Sat, 29 Sep 2012 20:49:32 +0000 (16:49 -0400)
this did not matter because we don't yet treat process-shared special.
when private futex support is added, however, it will matter.

src/thread/sem_open.c

index 0361a7695e387ce56e0e33fc3527878cb6a86b61..2e900eb3a2dc0e393d9c712c6ac460d323a29609 100644 (file)
@@ -71,7 +71,7 @@ sem_t *sem_open(const char *name, int flags, ...)
                        errno = EINVAL;
                        return SEM_FAILED;
                }
-               sem_init(&newsem, 0, value);
+               sem_init(&newsem, 1, value);
                clock_gettime(CLOCK_REALTIME, &ts);
                snprintf(tmp, sizeof(tmp), "/dev/shm/%p-%p-%d-%d",
                        &name, name, (int)getpid(), (int)ts.tv_nsec);