Twould help if we actually defined ->mod before comparing against it (reported and fixed by Juggie via IRC).
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77851 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
134d16b3d3
commit
a19b2fe6e3
|
@ -1662,6 +1662,7 @@ int ast_agi_register(struct ast_module *mod, agi_command *cmd)
|
||||||
ast_join(fullcmd, sizeof(fullcmd), cmd->cmda);
|
ast_join(fullcmd, sizeof(fullcmd), cmd->cmda);
|
||||||
|
|
||||||
if (!find_command(cmd->cmda,1)) {
|
if (!find_command(cmd->cmda,1)) {
|
||||||
|
cmd->mod = mod;
|
||||||
AST_RWLIST_WRLOCK(&agi_commands);
|
AST_RWLIST_WRLOCK(&agi_commands);
|
||||||
AST_LIST_INSERT_TAIL(&agi_commands, cmd, list);
|
AST_LIST_INSERT_TAIL(&agi_commands, cmd, list);
|
||||||
AST_RWLIST_UNLOCK(&agi_commands);
|
AST_RWLIST_UNLOCK(&agi_commands);
|
||||||
|
@ -1728,26 +1729,26 @@ static agi_command *find_command(char *cmds[], int exact)
|
||||||
AST_RWLIST_TRAVERSE(&agi_commands, e, list) {
|
AST_RWLIST_TRAVERSE(&agi_commands, e, list) {
|
||||||
if (!e->cmda[0])
|
if (!e->cmda[0])
|
||||||
break;
|
break;
|
||||||
/* start optimistic */
|
/* start optimistic */
|
||||||
match = 1;
|
match = 1;
|
||||||
for (y = 0; match && cmds[y]; y++) {
|
for (y = 0; match && cmds[y]; y++) {
|
||||||
/* If there are no more words in the command (and we're looking for
|
/* If there are no more words in the command (and we're looking for
|
||||||
an exact match) or there is a difference between the two words,
|
an exact match) or there is a difference between the two words,
|
||||||
then this is not a match */
|
then this is not a match */
|
||||||
if (!e->cmda[y] && !exact)
|
if (!e->cmda[y] && !exact)
|
||||||
break;
|
break;
|
||||||
/* don't segfault if the next part of a command doesn't exist */
|
/* don't segfault if the next part of a command doesn't exist */
|
||||||
if (!e->cmda[y])
|
if (!e->cmda[y])
|
||||||
return NULL;
|
return NULL;
|
||||||
if (strcasecmp(e->cmda[y], cmds[y]))
|
if (strcasecmp(e->cmda[y], cmds[y]))
|
||||||
match = 0;
|
|
||||||
}
|
|
||||||
/* If more words are needed to complete the command then this is not
|
|
||||||
a candidate (unless we're looking for a really inexact answer */
|
|
||||||
if ((exact > -1) && e->cmda[y])
|
|
||||||
match = 0;
|
match = 0;
|
||||||
if (match)
|
}
|
||||||
return e;
|
/* If more words are needed to complete the command then this is not
|
||||||
|
a candidate (unless we're looking for a really inexact answer */
|
||||||
|
if ((exact > -1) && e->cmda[y])
|
||||||
|
match = 0;
|
||||||
|
if (match)
|
||||||
|
return e;
|
||||||
}
|
}
|
||||||
AST_RWLIST_UNLOCK(&agi_commands);
|
AST_RWLIST_UNLOCK(&agi_commands);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue