From: Tilghman Lesher Date: Tue, 3 Jul 2007 12:34:14 +0000 (+0000) Subject: RetryDial should accept a 0 argument, but it does not, because atoi does not distingu... X-Git-Tag: 1.2.21~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff1c0bfa20f6397a3154be3b5dc7042c524e9e75;p=thirdparty%2Fasterisk.git RetryDial should accept a 0 argument, but it does not, because atoi does not distinguish between 0 and error (closes issue #10106) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@73052 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_dial.c b/apps/app_dial.c index d36677c2f5..834b7dc475 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -1706,7 +1706,7 @@ static int retrydial_exec(struct ast_channel *chan, void *data) if ((dialdata = strchr(announce, '|'))) { *dialdata = '\0'; dialdata++; - if ((sleep = atoi(dialdata))) { + if (sscanf(dialdata, "%d", &sleep) == 1) { sleep *= 1000; } else { ast_log(LOG_ERROR, "%s requires the numerical argument \n",rapp); @@ -1716,7 +1716,7 @@ static int retrydial_exec(struct ast_channel *chan, void *data) if ((dialdata = strchr(dialdata, '|'))) { *dialdata = '\0'; dialdata++; - if (!(loops = atoi(dialdata))) { + if (sscanf(dialdata, "%d", &loops) != 1) { ast_log(LOG_ERROR, "%s requires the numerical argument \n",rapp); LOCAL_USER_REMOVE(u); return -1;