[asterisk-commits] russell: branch 1.4 r91501 - in /branches/1.4: include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 6 13:11:36 CST 2007


Author: russell
Date: Thu Dec  6 13:11:35 2007
New Revision: 91501

URL: http://svn.digium.com/view/asterisk?view=rev&rev=91501
Log:
Add a new module flag to indicate that a build sum is present.  Modules built
against older Asterisk 1.4 headers will now load properly with just a warning
indicating that they are old and may cause problems.
(patch by paravoid)

Modified:
    branches/1.4/include/asterisk/module.h
    branches/1.4/main/loader.c

Modified: branches/1.4/include/asterisk/module.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/module.h?view=diff&rev=91501&r1=91500&r2=91501
==============================================================================
--- branches/1.4/include/asterisk/module.h (original)
+++ branches/1.4/include/asterisk/module.h Thu Dec  6 13:11:35 2007
@@ -179,6 +179,7 @@
 enum ast_module_flags {
 	AST_MODFLAG_DEFAULT = 0,
 	AST_MODFLAG_GLOBAL_SYMBOLS = (1 << 0),
+	AST_MODFLAG_BUILDSUM = (1 << 1),
 };
 
 struct ast_module_info {
@@ -233,7 +234,7 @@
 		AST_MODULE,				\
 		desc,					\
 		keystr,					\
-		flags_to_set,				\
+		flags_to_set | AST_MODFLAG_BUILDSUM,	\
 		AST_BUILDOPT_SUM,			\
 	};						\
 	static void  __attribute__ ((constructor)) __reg_module(void) \
@@ -261,7 +262,7 @@
 #define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)	\
 	static struct ast_module_info __mod_info = {		\
 		.name = AST_MODULE,				\
-		.flags = flags_to_set,				\
+		.flags = flags_to_set | AST_MODFLAG_BUILDSUM,	\
 		.description = desc,				\
 		.key = keystr,					\
 		.buildopt_sum = AST_BUILDOPT_SUM,		\

Modified: branches/1.4/main/loader.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/loader.c?view=diff&rev=91501&r1=91500&r2=91501
==============================================================================
--- branches/1.4/main/loader.c (original)
+++ branches/1.4/main/loader.c Thu Dec  6 13:11:35 2007
@@ -616,8 +616,10 @@
 		return 1;
 	}
 
-	if (!ast_strlen_zero(mod->info->buildopt_sum) &&
-	    strcmp(buildopt_sum, mod->info->buildopt_sum)) {
+	if (!ast_test_flag(mod->info, AST_MODFLAG_BUILDSUM)) {
+		ast_log(LOG_WARNING, "Module '%s' was not compiled against a recent version of Asterisk and may cause instability.\n", mod->resource);
+	} else if (!ast_strlen_zero(mod->info->buildopt_sum) &&
+		   strcmp(buildopt_sum, mod->info->buildopt_sum)) {
 		ast_log(LOG_WARNING, "Module '%s' was not compiled with the same compile-time options as this version of Asterisk.\n", mod->resource);
 		ast_log(LOG_WARNING, "Module '%s' will not be initialized as it may cause instability.\n", mod->resource);
 		return 1;




More information about the asterisk-commits mailing list