1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Fix the xRandomness() method on the unix VFS to return the number of bytes

of randomness obtained. (CVS 5821)

FossilOrigin-Name: b7687e2f2dfa5b0a01ba87ae0bf13684cda50499
This commit is contained in:
drh
2008-10-14 17:58:38 +00:00
parent 7cd30bd3d0
commit 72cbd078c3
3 changed files with 12 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
C Make\ssure\smalloc3.test\sruns\seven\sif\sa\sCREATE\sTABLE\stransaction\scommits\nprior\sto\sthe\slast\sOOM\serror.\s(CVS\s5820) C Fix\sthe\sxRandomness()\smethod\son\sthe\sunix\sVFS\sto\sreturn\sthe\snumber\sof\sbytes\nof\srandomness\sobtained.\s(CVS\s5821)
D 2008-10-14T15:54:08 D 2008-10-14T17:58:38
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 2014e5a4010ad5ebbcaedff98240b3d14ee83838 F Makefile.in 2014e5a4010ad5ebbcaedff98240b3d14ee83838
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -136,7 +136,7 @@ F src/os.c 0b411644b87ad689d7250bbfd1834d99b81a3df4
F src/os.h ef8abeb9afc694b82dbd169a91c9b7e26db3c892 F src/os.h ef8abeb9afc694b82dbd169a91c9b7e26db3c892
F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60 F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
F src/os_os2.c 24221ff5ab20cf3472e3ec7eec595f759de55298 F src/os_os2.c 24221ff5ab20cf3472e3ec7eec595f759de55298
F src/os_unix.c f33b69d8a85372b270fe37ee664a4c2140a5217d F src/os_unix.c 48527028ce548efb23c1e13f2e737eed8ee01444
F src/os_win.c 13bed718f62d64031b17bb3685adcf994dbf0232 F src/os_win.c 13bed718f62d64031b17bb3685adcf994dbf0232
F src/pager.c d98f56128e849083f2f612196efebd982c491fea F src/pager.c d98f56128e849083f2f612196efebd982c491fea
F src/pager.h 9c1917be28fff58118e1fe0ddbc7adfb8dd4f44d F src/pager.h 9c1917be28fff58118e1fe0ddbc7adfb8dd4f44d
@@ -648,7 +648,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 8eb315ee5c2a15919171b7d495ac4f1c851b2da9 P 603c40e5b47e4798136af5420a1fa1511791a934
R a1042910d9b1fd17ce238ac2a8c362fc R 616d48a51ad6a11056acefff803f6a5c
U drh U drh
Z 0f06f137a84a80abda597c94cdce859d Z 70ed6965e1e26d017ef8310705fad386

View File

@@ -1 +1 @@
603c40e5b47e4798136af5420a1fa1511791a934 b7687e2f2dfa5b0a01ba87ae0bf13684cda50499

View File

@@ -12,7 +12,7 @@
** **
** This file contains code that is specific to Unix systems. ** This file contains code that is specific to Unix systems.
** **
** $Id: os_unix.c,v 1.204 2008/09/24 09:12:47 danielk1977 Exp $ ** $Id: os_unix.c,v 1.205 2008/10/14 17:58:38 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#if SQLITE_OS_UNIX /* This file is used on unix only */ #if SQLITE_OS_UNIX /* This file is used on unix only */
@@ -2865,13 +2865,15 @@ static int unixRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
memcpy(zBuf, &t, sizeof(t)); memcpy(zBuf, &t, sizeof(t));
pid = getpid(); pid = getpid();
memcpy(&zBuf[sizeof(t)], &pid, sizeof(pid)); memcpy(&zBuf[sizeof(t)], &pid, sizeof(pid));
assert( sizeof(t)+sizeof(pid)<=nBuf );
nBuf = sizeof(t) + sizeof(pid);
}else{ }else{
read(fd, zBuf, nBuf); nBuf = read(fd, zBuf, nBuf);
close(fd); close(fd);
} }
} }
#endif #endif
return SQLITE_OK; return nBuf;
} }