[Asterisk-code-review] loader: Miscellaneous fixes. (asterisk[master])
Corey Farrell
asteriskteam at digium.com
Wed Jan 17 00:32:35 CST 2018
Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/7983
Change subject: loader: Miscellaneous fixes.
......................................................................
loader: Miscellaneous fixes.
* Remove comment about lazy load.
* Improve message about module already being loaded and running.
* Handle allocation add_to_load_order.
Change-Id: I22261599c46d0f416e568910ec9502f45143197f
---
M main/loader.c
1 file changed, 11 insertions(+), 5 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/83/7983/1
diff --git a/main/loader.c b/main/loader.c
index 88c1cda..7ddd805 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -524,9 +524,6 @@
* If somehow there was another dlopen() on the same module (unlikely,
* since that all is supposed to happen in loader.c).
*
- * Or the lazy resolution of a global symbol (very likely, since that is
- * how we load all of our modules that export global symbols).
- *
* Avoid the temptation of repeating the dlclose(). The other code that
* dlopened the module still has its module reference, and should close
* it itself. In other situations, dlclose() will happily return success
@@ -1168,7 +1165,7 @@
if ((mod = find_resource(resource_name, 0))) {
if (mod->flags.running) {
- ast_log(LOG_WARNING, "Module '%s' already exists.\n", resource_name);
+ ast_log(LOG_WARNING, "Module '%s' already loaded and running.\n", resource_name);
return AST_MODULE_LOAD_DECLINE;
}
if (global_symbols_only && !ast_test_flag(mod->info, AST_MODFLAG_GLOBAL_SYMBOLS))
@@ -1248,6 +1245,11 @@
return NULL;
order->resource = ast_strdup(resource);
+ if (!order->resource) {
+ ast_free(order);
+
+ return NULL;
+ }
order->required = required;
AST_LIST_INSERT_TAIL(load_order, order, entry);
@@ -1422,15 +1424,19 @@
/* first, find all the modules we have been explicitly requested to load */
for (v = ast_variable_browse(cfg, "modules"); v; v = v->next) {
+ if (find_resource(v->value, 0)) {
+ continue;
+ }
+
if (!strcasecmp(v->name, preload_only ? "preload" : "load")) {
add_to_load_order(v->value, &load_order, 0);
}
+
if (!strcasecmp(v->name, preload_only ? "preload-require" : "require")) {
/* Add the module to the list and make sure it's required */
add_to_load_order(v->value, &load_order, 1);
ast_debug(2, "Adding module to required list: %s (%s)\n", v->value, v->name);
}
-
}
/* check if 'autoload' is on */
--
To view, visit https://gerrit.asterisk.org/7983
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I22261599c46d0f416e568910ec9502f45143197f
Gerrit-Change-Number: 7983
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180117/bfa16efd/attachment.html>
More information about the asterisk-code-review
mailing list