/ Check-in [cfe0acf9]
Login
Overview
Comment:Reduce the randomness in the sqliteRandomSeed() routine in order to silence bogus errors from valgrind. Tickets #535 and #536. (CVS 1149)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:cfe0acf9ec6c89f1e77b8be7dcc23029984de1ce
User & Date: drh 2003-12-31 13:21:18
Context
2003-12-31
16:00
Fix a bug (ticket #541) introduced by the previous check-in ((1149)). (CVS 1150) check-in: 64624400 user: drh tags: trunk
13:21
Reduce the randomness in the sqliteRandomSeed() routine in order to silence bogus errors from valgrind. Tickets #535 and #536. (CVS 1149) check-in: cfe0acf9 user: drh tags: trunk
2003-12-24
01:41
minor edits for new date.c with mingw/msys on Windows (CVS 1148) check-in: 9392c514 user: dougcurrie tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/os.c.

1437
1438
1439
1440
1441
1442
1443
1444








1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456

/*
** Get information to seed the random number generator.  The seed
** is written into the buffer zBuf[256].  The calling function must
** 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.
  */
  memset(zBuf, 0, 256);
#endif
#if OS_UNIX && !defined(SQLITE_TEST)
  int pid;
  time((time_t*)zBuf);
  pid = getpid();
  memcpy(&zBuf[sizeof(time_t)], &pid, sizeof(pid));
#endif
#if OS_WIN && !defined(SQLITE_TEST)







|
>
>
>
>
>
>
>
>
|
|


<







1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456

1457
1458
1459
1460
1461
1462
1463

/*
** Get information to seed the random number generator.  The seed
** is written into the buffer zBuf[256].  The calling function must
** supply a sufficiently large buffer.
*/
int sqliteOsRandomSeed(char *zBuf){
  /* 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);

#if OS_UNIX && !defined(SQLITE_TEST)
  int pid;
  time((time_t*)zBuf);
  pid = getpid();
  memcpy(&zBuf[sizeof(time_t)], &pid, sizeof(pid));
#endif
#if OS_WIN && !defined(SQLITE_TEST)