summaryrefslogtreecommitdiff
path: root/src/platform.c
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2023-03-16 00:03:22 +0900
committerRyo Nakamura <upa@haeena.net>2023-03-16 00:03:22 +0900
commit6305f027707c68e8b0085ad909e3c4245c08bf71 (patch)
treec18c24908988ea214e160871356a525930c76d25 /src/platform.c
parentae4b848ba00d7fa49de4ea619e9e90e3eaa68354 (diff)
fix semaphore handling for macOS
Diffstat (limited to 'src/platform.c')
-rw-r--r--src/platform.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/platform.c b/src/platform.c
index ef1fe70..dfc7447 100644
--- a/src/platform.c
+++ b/src/platform.c
@@ -38,21 +38,19 @@ int set_thread_affinity(pthread_t tid, int core)
static void random_string(char *buf, size_t size)
{
- char chars[] = "abcdefhijklmnopkwxyz1234567890";
+ char chars[] = "abcdefhijklmnopqrstuvwxyz1234567890";
int n, x;
for (n = 0; n < size - 1; n++) {
- x = arc4random(sizeof(chars) - 1);
+ x = arc4random() % (sizeof(chars) - 1);
buf[n] = chars[x];
}
buf[size - 1] = '\0';
-
- return 0;
}
sem_t *sem_create(int value)
{
- char sem_name[PSEMNAMLEN] = "mscp-";
+ char sem_name[30] = "mscp-";
sem_t *sem;
int n;