From 6305f027707c68e8b0085ad909e3c4245c08bf71 Mon Sep 17 00:00:00 2001 From: Ryo Nakamura Date: Thu, 16 Mar 2023 00:03:22 +0900 Subject: fix semaphore handling for macOS --- src/platform.c | 8 +++----- 1 file 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; -- cgit v1.2.3