From: Jason Parker Date: Tue, 6 May 2008 19:34:58 +0000 (+0000) Subject: Switch to using ast_random() rather than just rand(). X-Git-Tag: 1.4.20~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=00415742a562f74e5e18a2549247639939d77738;p=thirdparty%2Fasterisk.git Switch to using ast_random() rather than just rand(). This does not fix the bug reported, but I believe it is correct. (from issue #12446) Patches: bug_12446.diff uploaded by snuffy (license 35) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@115418 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 0406a17968..faab84cae3 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -247,7 +247,7 @@ static int ast_moh_files_next(struct ast_channel *chan) } else if (ast_test_flag(state->class, MOH_RANDOMIZE)) { /* Get a random file and ensure we can open it */ for (tries = 0; tries < 20; tries++) { - state->pos = rand() % state->class->total_files; + state->pos = ast_random() % state->class->total_files; if (ast_fileexists(state->class->filearray[state->pos], NULL, NULL) > 0) break; }