[asterisk-commits] russell: branch 1.6.0 r184727 - in /branches/1.6.0: ./ apps/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 27 13:06:23 CDT 2009


Author: russell
Date: Fri Mar 27 13:06:20 2009
New Revision: 184727

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=184727
Log:
Merged revisions 184726 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r184726 | russell | 2009-03-27 13:04:43 -0500 (Fri, 27 Mar 2009) | 2 lines

Use ast_random() instead of rand() to ensure we use the best RNG available.

........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/apps/app_minivm.c
    branches/1.6.0/main/manager.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/apps/app_minivm.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.0/apps/app_minivm.c?view=diff&rev=184727&r1=184726&r2=184727
==============================================================================
--- branches/1.6.0/apps/app_minivm.c (original)
+++ branches/1.6.0/apps/app_minivm.c Fri Mar 27 13:06:20 2009
@@ -1031,7 +1031,7 @@
 	} 
 	ast_debug(4, "-_-_- Fromstring now: %s\n", ast_strlen_zero(passdata) ? "-default-" : passdata);
 
-	fprintf(p, "Message-ID: <Asterisk-%d-%s-%d-%s>\n", (unsigned int)rand(), vmu->username, (int)getpid(), who);
+	fprintf(p, "Message-ID: <Asterisk-%d-%s-%d-%s>\n", (unsigned int)ast_random(), vmu->username, (int)getpid(), who);
 	len_passdata = strlen(vmu->fullname) * 2 + 3;
 	passdata2 = alloca(len_passdata);
 	if (!ast_strlen_zero(vmu->email))
@@ -1064,7 +1064,7 @@
 	fprintf(p, "MIME-Version: 1.0\n");
 
 	/* Something unique. */
-	snprintf(bound, sizeof(bound), "voicemail_%s%d%d", vmu->username, (int)getpid(), (unsigned int)rand());
+	snprintf(bound, sizeof(bound), "voicemail_%s%d%d", vmu->username, (int)getpid(), (unsigned int)ast_random());
 
 	fprintf(p, "Content-Type: multipart/mixed; boundary=\"%s\"\n\n\n", bound);
 

Modified: branches/1.6.0/main/manager.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.0/main/manager.c?view=diff&rev=184727&r1=184726&r2=184727
==============================================================================
--- branches/1.6.0/main/manager.c (original)
+++ branches/1.6.0/main/manager.c Fri Mar 27 13:06:20 2009
@@ -3593,7 +3593,7 @@
 		 * properties of the rand() function (and the constantcy of s), that
 		 * won't happen twice in a row.
 		 */
-		while ((session->managerid = rand() ^ (unsigned long) session) == 0);
+		while ((session->managerid = ast_random() ^ (unsigned long) session) == 0);
 		session->last_ev = grab_last();
 		AST_LIST_LOCK(&sessions);
 		AST_LIST_INSERT_HEAD(&sessions, session, list);




More information about the asterisk-commits mailing list