diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-04-05 17:44:44 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-04-05 17:44:44 +0000 |
commit | e0ba99b7f5b9f06dda7fe4baa8a7fb90e2ab40c8 (patch) | |
tree | 6334c0ffd529b865c510fbfb7a06b71e2c6d6ceb /apps | |
parent | 54a140d030be645458cc82416501f0386e1d9e4b (diff) |
Bug 6873 - Finish moving from the non-threadsafe (and poor randomness) rand() to threadsafe ast_random()
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@17627 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_page.c | 2 | ||||
-rw-r--r-- | apps/app_queue.c | 4 | ||||
-rw-r--r-- | apps/app_voicemail.c | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/apps/app_page.c b/apps/app_page.c index a9ad2c16d..6051db440 100644 --- a/apps/app_page.c +++ b/apps/app_page.c @@ -143,7 +143,7 @@ static int page_exec(struct ast_channel *chan, void *data) char *tech, *resource; char meetmeopts[80]; struct ast_flags flags = { 0 }; - unsigned int confid = rand(); + unsigned int confid = ast_random(); struct ast_app *app; char *tmp; int res=0; diff --git a/apps/app_queue.c b/apps/app_queue.c index 9259bd77d..f79bb8a7c 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -1992,7 +1992,7 @@ static int calc_metric(struct ast_call_queue *q, struct member *mem, int pos, st tmp->metric += mem->penalty * 1000000; break; case QUEUE_STRATEGY_RANDOM: - tmp->metric = rand() % 1000; + tmp->metric = ast_random() % 1000; tmp->metric += mem->penalty * 1000000; break; case QUEUE_STRATEGY_FEWESTCALLS: @@ -2241,7 +2241,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce else { /* Last ditch effort -- no CDR, make up something */ char tmpid[256]; - snprintf(tmpid, sizeof(tmpid), "chan-%x", rand()); + snprintf(tmpid, sizeof(tmpid), "chan-%lx", ast_random()); ast_monitor_start(which, qe->parent->monfmt, tmpid, 1 ); } if (qe->parent->monjoin) diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 369008390..dc0f87e17 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -1753,11 +1753,11 @@ static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *c fprintf(p, "Subject: New message %d in mailbox %s\n", msgnum + 1, mailbox); else fprintf(p, "Subject: [PBX]: New message %d in mailbox %s\n", msgnum + 1, mailbox); - fprintf(p, "Message-ID: <Asterisk-%d-%d-%s-%d@%s>\n", msgnum, (unsigned int)rand(), mailbox, getpid(), host); + fprintf(p, "Message-ID: <Asterisk-%d-%d-%s-%d@%s>\n", msgnum, (unsigned int)ast_random(), mailbox, getpid(), host); fprintf(p, "MIME-Version: 1.0\n"); if (attach_user_voicemail) { /* Something unique. */ - snprintf(bound, sizeof(bound), "voicemail_%d%s%d%d", msgnum, mailbox, getpid(), (unsigned int)rand()); + snprintf(bound, sizeof(bound), "voicemail_%d%s%d%d", msgnum, mailbox, getpid(), (unsigned int)ast_random()); fprintf(p, "Content-Type: multipart/mixed; boundary=\"%s\"\n\n\n", bound); |