[Asterisk-cvs] asterisk asterisk.c,1.125.2.7,1.125.2.8

russell at lists.digium.com russell at lists.digium.com
Sun May 15 22:59:36 CDT 2005


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv20174

Modified Files:
      Tag: v1-0
	asterisk.c 
Log Message:
only initialize random number generators in one place (bug #4017)


Index: asterisk.c
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.125.2.7
retrieving revision 1.125.2.8
diff -u -d -r1.125.2.7 -r1.125.2.8
--- asterisk.c	15 May 2005 15:55:30 -0000	1.125.2.7
+++ asterisk.c	16 May 2005 03:04:58 -0000	1.125.2.8
@@ -1824,6 +1824,12 @@
 	signal(SIGCHLD, child_handler);
 	signal(SIGPIPE, SIG_IGN);
 
+	/* ensure that the random number generators are seeded with a different value every time
+	   Asterisk is started
+	*/
+	srand((unsigned int) getpid() + (unsigned int) time(NULL));
+	srandom((unsigned int) getpid() + (unsigned int) time(NULL));
+
 	if (init_logger()) {
 		printf(term_quit());
 		exit(1);




More information about the svn-commits mailing list