aboutsummaryrefslogtreecommitdiffstats
path: root/app.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-13 18:12:48 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-13 18:12:48 +0000
commit22844a983b74fa9d2863722b23509eded2eacef8 (patch)
treeb4ad69683847fd6097b2f19bf1b17c01b8988409 /app.c
parentd950f51711406d6c20fde293627c3dadd22a810c (diff)
Return group counting to previous behavior where you could only have one group per category. (issue #9711 reported by irroot)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@69127 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'app.c')
-rw-r--r--app.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/app.c b/app.c
index f99775248..33b318dd2 100644
--- a/app.c
+++ b/app.c
@@ -1047,12 +1047,16 @@ int ast_app_group_set_channel(struct ast_channel *chan, char *data)
len += strlen(category) + 1;
AST_LIST_LOCK(&groups);
- AST_LIST_TRAVERSE(&groups, gi, list) {
- if (gi->chan == chan && !strcasecmp(gi->group, group) && (ast_strlen_zero(category) || (!ast_strlen_zero(gi->category) && !strcasecmp(gi->category, category))))
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&groups, gi, list) {
+ if ((gi->chan == chan) && ((ast_strlen_zero(category) && ast_strlen_zero(gi->category)) || (!ast_strlen_zero(gi->category) && !strcasecmp(gi->category, category)))) {
+ AST_LIST_REMOVE_CURRENT(&groups, list);
+ free(gi);
break;
+ }
}
+ AST_LIST_TRAVERSE_SAFE_END
- if (!gi && (gi = calloc(1, len))) {
+ if ((gi = calloc(1, len))) {
gi->chan = chan;
gi->group = (char *) gi + sizeof(*gi);
strcpy(gi->group, group);