1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Reduce the randomness in the sqliteRandomSeed() routine in order to silence

bogus errors from valgrind.  Tickets #535 and #536. (CVS 1149)

FossilOrigin-Name: cfe0acf9ec6c89f1e77b8be7dcc23029984de1ce
This commit is contained in:
drh
2003-12-31 13:21:18 +00:00
parent ae53418df4
commit dff7ec2cbd
3 changed files with 19 additions and 12 deletions

View File

@@ -1441,12 +1441,19 @@ int sqliteOsUnlock(OsFile *id){
** supply a sufficiently large buffer.
*/
int sqliteOsRandomSeed(char *zBuf){
#ifdef SQLITE_TEST
/* When testing, always use the same random number sequence.
** This makes the tests repeatable.
/* We have to initialize zBuf to prevent valgrind from reporting
** errors. The reports issued by valgrind are incorrect - we would
** prefer that the randomness be increased by making use of the
** uninitialized space in zBuf - but valgrind errors tend to worry
** some users. Rather than argue, it seems easier just to initialize
** the whole array and silence valgrind, even if that means less randomness
** in the random seed.
**
** When testing, initializing zBuf[] to zero is all we do. That means
** that we always use the same random number sequence.* This makes the
** tests repeatable.
*/
memset(zBuf, 0, 256);
#endif
#if OS_UNIX && !defined(SQLITE_TEST)
int pid;
time((time_t*)zBuf);