summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDion Williams <dionrhys1@gmail.com>2015-09-07 11:32:43 +0100
committerTim Angus <tim@ngus.net>2016-04-07 11:05:38 +0100
commit88bdc8f9da2a1d3f31de758f1a2b75f87284b133 (patch)
treeb00f38ebef4816637dadaf17f7a25321127fd61f
parentae6435c1b3064f44702535c0df99e42e9752a1df (diff)
Ensure reads from /dev/urandom are unbuffered
Upstream: JACoders/OpenJK@de6a9dfd40065ae9a5a2b0b3ef701feee8dac867
-rw-r--r--src/sys/sys_unix.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/sys/sys_unix.c b/src/sys/sys_unix.c
index dd77e0da..22af0fcf 100644
--- a/src/sys/sys_unix.c
+++ b/src/sys/sys_unix.c
@@ -116,6 +116,8 @@ qboolean Sys_RandomBytes( byte *string, int len )
if( !fp )
return qfalse;
+ setvbuf( fp, NULL, _IONBF, 0 ); // don't buffer reads from /dev/urandom
+
if( fread( string, sizeof( byte ), len, fp ) != len )
{
fclose( fp );