]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix a logic error I found while searching through chan_agent.c
authorMark Michelson <mmichelson@digium.com>
Wed, 14 Jan 2009 16:19:26 +0000 (16:19 +0000)
committerMark Michelson <mmichelson@digium.com>
Wed, 14 Jan 2009 16:19:26 +0000 (16:19 +0000)
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

channels/chan_agent.c

index daa8a9d082f2c3c259a5c1ab1d8301c5eec89a09..b12983dfc573a220c54c87938e022b51924cef82 100644 (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;