aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
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;
}