mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
Fix a logic error I found while searching through chan_agent.c
I found that the allow_multiple_logins function would never return 0 due to an incorrect comparison being used when traversing the list of agents. While I was modifying this function, I also did a little bit of coding guidelines cleanup, too. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@168598 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1401,15 +1401,17 @@ static int allow_multiple_login(char *chan, char *context)
|
|||||||
struct agent_pvt *p;
|
struct agent_pvt *p;
|
||||||
char loginchan[80];
|
char loginchan[80];
|
||||||
|
|
||||||
if(multiplelogin)
|
if (multiplelogin) {
|
||||||
return 1;
|
return 1;
|
||||||
if(!chan)
|
}
|
||||||
|
if (!chan) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(loginchan, sizeof(loginchan), "%s@%s", chan, S_OR(context, "default"));
|
snprintf(loginchan, sizeof(loginchan), "%s@%s", chan, S_OR(context, "default"));
|
||||||
|
|
||||||
AST_LIST_TRAVERSE(&agents, p, list) {
|
AST_LIST_TRAVERSE(&agents, p, list) {
|
||||||
if(!strcasecmp(chan, p->loginchan))
|
if(!strcasecmp(loginchan, p->loginchan))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
Reference in New Issue
Block a user