main: use /dev/urandom by default
authorFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 27 Mar 2013 17:57:09 +0000 (13:57 -0400)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 27 Mar 2013 17:57:25 +0000 (13:57 -0400)
Reading /dev/random blocks when the system doesn't have enough
entropy. Reading /dev/urandom doesn't block and is presumed to be
good enough for our purposes

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/main.c

index 141c6cd..aa7e214 100644 (file)
@@ -287,9 +287,9 @@ static void initRandom(void) {
 #ifndef _WIN32
   int randomFile;
 
-  randomFile = open("/dev/random", O_RDONLY);
+  randomFile = open("/dev/urandom", O_RDONLY);
   if (randomFile == -1) {
-    randomFile = open("/dev/urandom", O_RDONLY);
+    randomFile = open("/dev/random", O_RDONLY);
   }
 
   if (randomFile != -1) {