summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@lodoss.net>2013-10-23 16:00:26 +0100
committerFederico G. Schwindt <fgsch@lodoss.net>2013-10-23 16:00:26 +0100
commit8e6db769ac549cfe26042f7d51ae8a301d8fc569 (patch)
tree258cb9f9ed690c9dd85bf566937d6df8fe89e69b /src
parent8a041373bb81f75a91a00e692979619938199989 (diff)
downloadngircd-8e6db769ac549cfe26042f7d51ae8a301d8fc569.tar.gz
ngircd-8e6db769ac549cfe26042f7d51ae8a301d8fc569.zip
Check and call arc4random_stir() if present
FreeBSD prior to 10.0 does not automatically stir on fork(). Same with
current NetBSD. If arc4random_stir() is present assume is needed and
call it instead of srand().
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/proc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ngircd/proc.c b/src/ngircd/proc.c
index d290f3bd..a5afb501 100644
--- a/src/ngircd/proc.c
+++ b/src/ngircd/proc.c
@@ -77,6 +77,9 @@ Proc_Fork(PROC_STAT *proc, int *pipefds, void (*cbfunc)(int, short), int timeout
 		return -1;
 	case 0:
 		/* New child process: */
+#ifdef HAVE_ARC4RANDOM_STIR
+		arc4random_stir();
+#endif
 #ifndef HAVE_ARC4RANDOM
 		srand(seed ^ (unsigned int)time(NULL) ^ getpid());
 #endif