aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2008-10-14 17:58:38 +0000
committerdrh <drh@noemail.net>2008-10-14 17:58:38 +0000
commit72cbd078c33c3e2f20429963129f75aea07cf2ee (patch)
tree553f1b4bc3ea9c5bbcae12dcc12e09deb7a5929e /src/os_unix.c
parent7cd30bd3d07ee7331342d5c0fa1473afa8309c6b (diff)
downloadsqlite-72cbd078c33c3e2f20429963129f75aea07cf2ee.tar.gz
sqlite-72cbd078c33c3e2f20429963129f75aea07cf2ee.zip
Fix the xRandomness() method on the unix VFS to return the number of bytes
of randomness obtained. (CVS 5821) FossilOrigin-Name: b7687e2f2dfa5b0a01ba87ae0bf13684cda50499
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 140fdbd57..159c8d1e4 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;
}