<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/7983">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Richard Mudgett: Looks good to me, but someone else must approve
Benjamin Keith Ford: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, approved
Jenkins2: Approved for Submit
</div><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 error in add_to_load_order.<br>* Dead code elimination from modules_shutdown.<br><br>Change-Id: I22261599c46d0f416e568910ec9502f45143197f<br>---<br>M main/loader.c<br>1 file changed, 12 insertions(+), 16 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/loader.c b/main/loader.c<br>index 88c1cda..8f3fbe0 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>@@ -631,7 +628,8 @@<br> int modules_shutdown(void)<br> {<br> struct ast_module *mod;<br>- int somethingchanged = 1, final = 0;<br>+ int somethingchanged;<br>+ int res;<br> <br> AST_DLLIST_LOCK(&module_list);<br> <br>@@ -639,17 +637,11 @@<br> * may be still in use, even if all channels are dead. We must therefore<br> * check the usecount before asking modules to unload. */<br> do {<br>- if (!somethingchanged) {<br>- /*!\note If we go through the entire list without changing<br>- * anything, ignore the usecounts and unload, then exit. */<br>- final = 1;<br>- }<br>-<br> /* Reset flag before traversing the list */<br> somethingchanged = 0;<br> <br> AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_BEGIN(&module_list, mod, entry) {<br>- if (!final && mod->usecount) {<br>+ if (mod->usecount) {<br> ast_debug(1, "Passing on %s: its use count is %d\n",<br> mod->resource, mod->usecount);<br> continue;<br>@@ -672,12 +664,12 @@<br> }<br> }<br> }<br>- } while (somethingchanged && !final);<br>+ } while (somethingchanged);<br> <br>- final = AST_DLLIST_EMPTY(&module_list);<br>+ res = AST_DLLIST_EMPTY(&module_list);<br> AST_DLLIST_UNLOCK(&module_list);<br> <br>- return !final;<br>+ return !res;<br> }<br> <br> int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode force)<br>@@ -1168,7 +1160,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 +1240,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>@@ -1430,7 +1427,6 @@<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: merged </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: 2 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>