<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7983">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">loader: Miscellaneous fixes.<br><br>* Remove comment about lazy load.<br>* Improve message about module already being loaded and running.<br>* Handle allocation add_to_load_order.<br><br>Change-Id: I22261599c46d0f416e568910ec9502f45143197f<br>---<br>M main/loader.c<br>1 file changed, 11 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/83/7983/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/loader.c b/main/loader.c<br>index 88c1cda..7ddd805 100644<br>--- a/main/loader.c<br>+++ b/main/loader.c<br>@@ -524,9 +524,6 @@<br> * If somehow there was another dlopen() on the same module (unlikely,<br> * since that all is supposed to happen in loader.c).<br> *<br>- * Or the lazy resolution of a global symbol (very likely, since that is<br>- * how we load all of our modules that export global symbols).<br>- *<br> * Avoid the temptation of repeating the dlclose(). The other code that<br> * dlopened the module still has its module reference, and should close<br> * it itself. In other situations, dlclose() will happily return success<br>@@ -1168,7 +1165,7 @@<br> <br> if ((mod = find_resource(resource_name, 0))) {<br> if (mod->flags.running) {<br>- ast_log(LOG_WARNING, "Module '%s' already exists.\n", resource_name);<br>+ ast_log(LOG_WARNING, "Module '%s' already loaded and running.\n", resource_name);<br> return AST_MODULE_LOAD_DECLINE;<br> }<br> if (global_symbols_only && !ast_test_flag(mod->info, AST_MODFLAG_GLOBAL_SYMBOLS))<br>@@ -1248,6 +1245,11 @@<br> return NULL;<br> <br> order->resource = ast_strdup(resource);<br>+ if (!order->resource) {<br>+ ast_free(order);<br>+<br>+ return NULL;<br>+ }<br> order->required = required;<br> AST_LIST_INSERT_TAIL(load_order, order, entry);<br> <br>@@ -1422,15 +1424,19 @@<br> <br> /* first, find all the modules we have been explicitly requested to load */<br> for (v = ast_variable_browse(cfg, "modules"); v; v = v->next) {<br>+ if (find_resource(v->value, 0)) {<br>+ continue;<br>+ }<br>+<br> if (!strcasecmp(v->name, preload_only ? "preload" : "load")) {<br> add_to_load_order(v->value, &load_order, 0);<br> }<br>+<br> if (!strcasecmp(v->name, preload_only ? "preload-require" : "require")) {<br> /* Add the module to the list and make sure it's required */<br> add_to_load_order(v->value, &load_order, 1);<br> ast_debug(2, "Adding module to required list: %s (%s)\n", v->value, v->name);<br> }<br>-<br> }<br> <br> /* check if 'autoload' is on */<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7983">change 7983</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/7983"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I22261599c46d0f416e568910ec9502f45143197f </div>
<div style="display:none"> Gerrit-Change-Number: 7983 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>