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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user