17 lines
700 B
Text
17 lines
700 B
Text
Use HAVE_ARC4RANDOM and choose to call arc4random() instead of srand()
|
|
and rand() and friends.
|
|
|
|
--- lib/sqlite/sqlite3.c.orig Tue Nov 29 02:35:28 2016
|
|
+++ lib/sqlite/sqlite3.c Thu Dec 15 11:29:38 2016
|
|
@@ -32221,7 +32221,11 @@ static int afpLock(sqlite3_file *id, int eFileLock){
|
|
mask = (sizeof(long)==8) ? LARGEST_INT64 : 0x7fffffff;
|
|
/* Now get the read-lock SHARED_LOCK */
|
|
/* note that the quality of the randomness doesn't matter that much */
|
|
+#ifdef HAVE_ARC4RANDOM
|
|
+ lk = arc4random();
|
|
+#else
|
|
lk = random();
|
|
+#endif
|
|
pInode->sharedByte = (lk & mask)%(SHARED_SIZE - 1);
|
|
lrc1 = afpSetLock(context->dbPath, pFile,
|
|
SHARED_FIRST+pInode->sharedByte, 1, 1);
|