diff options
author | drh <drh@noemail.net> | 2014-10-24 12:37:00 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2014-10-24 12:37:00 +0000 |
commit | 5a5d120bcc08af809b8687ff9fe39fce27e7796c (patch) | |
tree | ff19e4ce1ac1204e444847992cf9e8846ab45c20 /src/random.c | |
parent | 9ca95730e3a25bf5b335ec73a0a14f0112a421fb (diff) | |
download | sqlite-5a5d120bcc08af809b8687ff9fe39fce27e7796c.tar.gz sqlite-5a5d120bcc08af809b8687ff9fe39fce27e7796c.zip |
Fix two problems. Tests now passing.
FossilOrigin-Name: 1c220b806d56e163842e17038c3331f71861bd9c
Diffstat (limited to 'src/random.c')
-rw-r--r-- | src/random.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/random.c b/src/random.c index 7bca0d71a..c4241362d 100644 --- a/src/random.c +++ b/src/random.c @@ -37,7 +37,6 @@ void sqlite3_randomness(int N, void *pBuf){ #ifndef SQLITE_OMIT_AUTOINIT if( sqlite3_initialize() ) return; #endif - if( pBuf==0 || N<=0 ) return; /* The "wsdPrng" macro will resolve to the pseudo-random number generator ** state vector. If writable static data is unsupported on the target, @@ -57,6 +56,12 @@ void sqlite3_randomness(int N, void *pBuf){ sqlite3_mutex_enter(mutex); #endif + if( N<=0 || pBuf==0 ){ + wsdPrng.isInit = 0; + sqlite3_mutex_leave(mutex); + return; + } + /* Initialize the state of the random number generator once, ** the first time this routine is called. The seed value does ** not need to contain a lot of randomness since we are not |