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:
Mark Michelson
2009-01-14 16:19:26 +00:00
parent b3ea953313
commit 3af85c8b97

View File

@@ -1401,15 +1401,17 @@ static int allow_multiple_login(char *chan, char *context)
struct agent_pvt *p;
char loginchan[80];
if(multiplelogin)
if (multiplelogin) {
return 1;
if(!chan)
}
if (!chan) {
return 0;
}
snprintf(loginchan, sizeof(loginchan), "%s@%s", chan, S_OR(context, "default"));
AST_LIST_TRAVERSE(&agents, p, list) {
if(!strcasecmp(chan, p->loginchan))
if(!strcasecmp(loginchan, p->loginchan))
return 0;
}
return -1;