From: Tilghman Lesher Date: Mon, 1 Jun 2009 20:07:04 +0000 (+0000) Subject: If using the old deprecated format, a reload would cause the class to disappear. X-Git-Tag: 1.4.26-rc2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af31809bcf8b901cc9a53d3ea0e743f9b2a47628;p=thirdparty%2Fasterisk.git 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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@198665 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 33f258dc0a..4ec9e648f3 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -157,6 +157,7 @@ struct mohclass { /*! 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 @@ static int load_moh_classes(int reload) *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 @@ static int load_moh_classes(int reload) 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 @@ static int load_moh_classes(int reload) 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 @@ static int load_moh_classes(int reload) 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;