Skip to content

Commit 0202ddb

Browse files
committed
fix(apple): do not use sys/random
1 parent 3b5b888 commit 0202ddb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/utils.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
#else
1818
#include <uuid/uuid.h>
1919
#include <unistd.h>
20+
#if defined(__linux__)
2021
#include <sys/random.h>
2122
#endif
23+
#endif
2224

2325
#ifndef SQLITE_CORE
2426
SQLITE_EXTENSION_INIT3
@@ -47,6 +49,9 @@ int cloudsync_uuid_v7 (uint8_t value[UUID_LEN]) {
4749
// fill the buffer with high-quality random data
4850
#ifdef _WIN32
4951
if (BCryptGenRandom(NULL, (BYTE*)value, UUID_LEN, BCRYPT_USE_SYSTEM_PREFERRED_RNG) != STATUS_SUCCESS) return -1;
52+
#elif defined(__APPLE__)
53+
// Use arc4random_buf for macOS/iOS
54+
arc4random_buf(value, UUID_LEN);
5055
#else
5156
if (getentropy(value, UUID_LEN) != 0) return -1;
5257
#endif

0 commit comments

Comments
 (0)