From: drh Date: Tue, 14 Oct 2008 17:58:38 +0000 (+0000) Subject: Fix the xRandomness() method on the unix VFS to return the number of bytes X-Git-Tag: version-3.6.10~356 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72cbd078c33c3e2f20429963129f75aea07cf2ee;p=thirdparty%2Fsqlite.git Fix the xRandomness() method on the unix VFS to return the number of bytes of randomness obtained. (CVS 5821) FossilOrigin-Name: b7687e2f2dfa5b0a01ba87ae0bf13684cda50499 --- diff --git a/manifest b/manifest index 87219dd70e..852e87683d 100644 --- a/manifest +++ b/manifest @@ -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) -D 2008-10-14T15:54:08 +C Fix\sthe\sxRandomness()\smethod\son\sthe\sunix\sVFS\sto\sreturn\sthe\snumber\sof\sbytes\nof\srandomness\sobtained.\s(CVS\s5821) +D 2008-10-14T17:58:38 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 2014e5a4010ad5ebbcaedff98240b3d14ee83838 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -136,7 +136,7 @@ F src/os.c 0b411644b87ad689d7250bbfd1834d99b81a3df4 F src/os.h ef8abeb9afc694b82dbd169a91c9b7e26db3c892 F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60 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/pager.c d98f56128e849083f2f612196efebd982c491fea F src/pager.h 9c1917be28fff58118e1fe0ddbc7adfb8dd4f44d @@ -648,7 +648,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 8eb315ee5c2a15919171b7d495ac4f1c851b2da9 -R a1042910d9b1fd17ce238ac2a8c362fc +P 603c40e5b47e4798136af5420a1fa1511791a934 +R 616d48a51ad6a11056acefff803f6a5c U drh -Z 0f06f137a84a80abda597c94cdce859d +Z 70ed6965e1e26d017ef8310705fad386 diff --git a/manifest.uuid b/manifest.uuid index 60774716fd..41156bad44 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -603c40e5b47e4798136af5420a1fa1511791a934 \ No newline at end of file +b7687e2f2dfa5b0a01ba87ae0bf13684cda50499 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 140fdbd579..159c8d1e48 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -12,7 +12,7 @@ ** ** 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" #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)); pid = getpid(); memcpy(&zBuf[sizeof(t)], &pid, sizeof(pid)); + assert( sizeof(t)+sizeof(pid)<=nBuf ); + nBuf = sizeof(t) + sizeof(pid); }else{ - read(fd, zBuf, nBuf); + nBuf = read(fd, zBuf, nBuf); close(fd); } } #endif - return SQLITE_OK; + return nBuf; }