[asterisk-commits] tilghman: branch 1.4 r198665 - /branches/1.4/res/res_musiconhold.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 1 15:07:10 CDT 2009


Author: tilghman
Date: Mon Jun  1 15:07:04 2009
New Revision: 198665

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=198665
Log:
If using the old deprecated format, a reload would cause the class to disappear.
(closes issue #14759)
 Reported by: lidocaineus
 Patches: 
       20090518__issue14759.diff.txt uploaded by tilghman (license 14)
 Tested by: lmadsen

Modified:
    branches/1.4/res/res_musiconhold.c

Modified: branches/1.4/res/res_musiconhold.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/res/res_musiconhold.c?view=diff&rev=198665&r1=198664&r2=198665
==============================================================================
--- branches/1.4/res/res_musiconhold.c (original)
+++ branches/1.4/res/res_musiconhold.c Mon Jun  1 15:07:04 2009
@@ -157,6 +157,7 @@
 	/*! FD for timing source */
 	int pseudofd;
 	unsigned int delete:1;
+	unsigned int deprecated:1;
 	AST_LIST_HEAD_NOLOCK(, mohdata) members;
 	AST_LIST_ENTRY(mohclass) list;
 };
@@ -1243,7 +1244,8 @@
 			*args++ = '\0';
 		}
 
-		if ((tmp_class = get_mohbyname(var->name, 0))) {
+		/* Only skip if this is a duplicate of an above item */
+		if ((tmp_class = get_mohbyname(var->name, 0)) && !tmp_class->deprecated && !tmp_class->delete) {
 			tmp_class = mohclass_unref(tmp_class);
 			continue;
 		}
@@ -1251,14 +1253,15 @@
 		if (!(class = moh_class_malloc())) {
 			break;
 		}
-				
+
+		class->deprecated = 1;
 		ast_copy_string(class->name, var->name, sizeof(class->name));
 		ast_copy_string(class->dir, data, sizeof(class->dir));
 		ast_copy_string(class->mode, var->value, sizeof(class->mode));
 		if (args) {
 			ast_copy_string(class->args, args, sizeof(class->args));
 		}
-				
+
 		moh_register(class, reload);
 		class = NULL;
 
@@ -1273,7 +1276,8 @@
 			dep_warning = 1;
 		}
 
-		if ((tmp_class = get_mohbyname(var->name, 0))) {
+		/* Only skip if this is a duplicate of an above item */
+		if ((tmp_class = get_mohbyname(var->name, 0)) && !tmp_class->deprecated && !tmp_class->delete) {
 			tmp_class = mohclass_unref(tmp_class);
 			continue;
 		}
@@ -1285,14 +1289,15 @@
 		if (!(class = moh_class_malloc())) {
 			break;
 		}
-			
+
+		class->deprecated = 1;
 		ast_copy_string(class->name, var->name, sizeof(class->name));
 		ast_copy_string(class->dir, var->value, sizeof(class->dir));
 		ast_copy_string(class->mode, "files", sizeof(class->mode));
 		if (args) {
 			ast_copy_string(class->args, args, sizeof(class->args));
 		}
-			
+
 		moh_register(class, reload);
 		class = NULL;
 




More information about the asterisk-commits mailing list