[svn-commits] russell: branch 1.4 r161948 - /branches/1.4/main/app.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Dec 9 08:52:38 CST 2008


Author: russell
Date: Tue Dec  9 08:52:25 2008
New Revision: 161948

URL: http://svn.digium.com/view/asterisk?view=rev&rev=161948
Log:
Fix a problem with GROUP() settings on a masquerade.

The previous code carried over group settings from the old channel to the new
one.  However, it did nothing with the group settings that were already on the
new channel.  This patch removes all group settings that already existed on the
new channel.

I have a more complicated version of this patch which addresses only the most
blatant problem with this, which is that a channel can end up with multiple
group settings in the same category.  However, I could not think of a use case
for keeping any of the group settings from the old channel, so I went this route
for now.

(closes AST-152)

Modified:
    branches/1.4/main/app.c

Modified: branches/1.4/main/app.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/app.c?view=diff&rev=161948&r1=161947&r2=161948
==============================================================================
--- branches/1.4/main/app.c (original)
+++ branches/1.4/main/app.c Tue Dec  9 08:52:25 2008
@@ -915,10 +915,15 @@
 	struct ast_group_info *gi = NULL;
 
 	AST_LIST_LOCK(&groups);
-	AST_LIST_TRAVERSE(&groups, gi, list) {
-		if (gi->chan == old)
+	AST_LIST_TRAVERSE_SAFE_BEGIN(&groups, gi, list) {
+		if (gi->chan == old) {
 			gi->chan = new;
-	}
+		} else if (gi->chan == new) {
+			AST_LIST_REMOVE_CURRENT(&groups, list);
+			free(gi);
+		}
+	}
+	AST_LIST_TRAVERSE_SAFE_END
 	AST_LIST_UNLOCK(&groups);
 
 	return 0;




More information about the svn-commits mailing list