mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-11-10 14:41:42 +00:00
Merge pull request #153 from dionrhys/read-urandom-unbuffered
Ensure reads from /dev/urandom are unbuffered
This commit is contained in:
commit
ed845a57c6
1 changed files with 2 additions and 0 deletions
|
@ -123,6 +123,8 @@ qboolean Sys_RandomBytes( byte *string, int len )
|
||||||
if( !fp )
|
if( !fp )
|
||||||
return qfalse;
|
return qfalse;
|
||||||
|
|
||||||
|
setvbuf( fp, NULL, _IONBF, 0 ); // don't buffer reads from /dev/urandom
|
||||||
|
|
||||||
if( fread( string, sizeof( byte ), len, fp ) != len )
|
if( fread( string, sizeof( byte ), len, fp ) != len )
|
||||||
{
|
{
|
||||||
fclose( fp );
|
fclose( fp );
|
||||||
|
|
Loading…
Reference in a new issue