<p>Chris Savinovich has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/9883">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pbx_config.c:<br><br>Added exit if conf file not available<br>on load_module, and also made sure<br>everything gets unregistered on unload.<br><br>Change-Id: Ib00665106043b1be5148ffa7a477396038915854<br>---<br>M pbx/pbx_config.c<br>1 file changed, 13 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/9883/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c</span><br><span>index 65daa2a..a1518aa 100644</span><br><span>--- a/pbx/pbx_config.c</span><br><span>+++ b/pbx/pbx_config.c</span><br><span>@@ -1599,15 +1599,15 @@</span><br><span> */</span><br><span> static int unload_module(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- if (static_config && !write_protect_config)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli_unregister(&cli_dialplan_save);</span><br><span style="color: hsl(0, 100%, 40%);">- if (overrideswitch_config) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_free(overrideswitch_config);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_cli_unregister(&cli_dialplan_save);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(overrideswitch_config);</span><br><span style="color: hsl(120, 100%, 40%);">+ overrideswitch_config = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> ast_cli_unregister_multiple(cli_pbx_config, ARRAY_LEN(cli_pbx_config));</span><br><span> ast_manager_unregister(AMI_EXTENSION_ADD);</span><br><span> ast_manager_unregister(AMI_EXTENSION_REMOVE);</span><br><span> ast_context_destroy(NULL, registrar);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> return 0;</span><br><span> }</span><br><span> </span><br><span>@@ -2074,6 +2074,14 @@</span><br><span> static int load_module(void)</span><br><span> {</span><br><span> int res;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_config *cfg;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_flags config_flags = { 0 };</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ cfg = ast_config_load(config, config_flags);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) {</span><br><span style="color: hsl(120, 100%, 40%);">+ unload_module();</span><br><span style="color: hsl(120, 100%, 40%);">+ return AST_MODULE_LOAD_DECLINE;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span> if (static_config && !write_protect_config)</span><br><span> ast_cli_register(&cli_dialplan_save);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9883">change 9883</a>. To unsubscribe, or for help writing mail filters, 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/9883"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ib00665106043b1be5148ffa7a477396038915854 </div>
<div style="display:none"> Gerrit-Change-Number: 9883 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Chris Savinovich <csavinovich@digium.com> </div>