summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorGeorge Joseph <gjoseph@digium.com>2017-04-11 10:07:39 -0600
committerGeorge Joseph <gjoseph@digium.com>2017-04-12 15:47:56 -0600
commitcc668bd522fceb9cb6cd0d69f5e29c28f1835b2a (patch)
treef4ea57201c41cde4cf2a326d400eed2e41179b52 /apps
parent0986618c94cbe0e2d95354f867c6cc966758a025 (diff)
modules: change module LOAD_FAILUREs to LOAD_DECLINES
In all non-pbx modules, AST_MODULE_LOAD_FAILURE has been changed to AST_MODULE_LOAD_DECLINE. This prevents asterisk from exiting if a module can't be loaded. If the user wishes to retain the FAILURE behavior for a specific module, they can use the "require" or "preload-require" keyword in modules.conf. A new API was added to logger: ast_is_logger_initialized(). This allows asterisk.c/check_init() to print to the error log once the logger subsystem is ready instead of just to stdout. If something does fail before the logger is initialized, we now print to stderr instead of stdout. Change-Id: I5f4b50623d9b5a6cb7c5624a8c5c1274c13b2b25
Diffstat (limited to 'apps')
-rw-r--r--apps/app_adsiprog.c2
-rw-r--r--apps/app_agent_pool.c5
-rw-r--r--apps/app_alarmreceiver.c2
-rw-r--r--apps/app_authenticate.c2
-rw-r--r--apps/app_cdr.c5
-rw-r--r--apps/app_confbridge.c6
-rw-r--r--apps/app_dahdiras.c2
-rw-r--r--apps/app_forkcdr.c6
-rw-r--r--apps/app_queue.c2
-rw-r--r--apps/app_voicemail.c2
-rw-r--r--apps/app_zapateller.c2
11 files changed, 20 insertions, 16 deletions
diff --git a/apps/app_adsiprog.c b/apps/app_adsiprog.c
index 3f3d11c25..1c9f37bd5 100644
--- a/apps/app_adsiprog.c
+++ b/apps/app_adsiprog.c
@@ -1607,7 +1607,7 @@ static int unload_module(void)
static int load_module(void)
{
if (ast_register_application_xml(app, adsi_exec))
- return AST_MODULE_LOAD_FAILURE;
+ return AST_MODULE_LOAD_DECLINE;
return AST_MODULE_LOAD_SUCCESS;
}
diff --git a/apps/app_agent_pool.c b/apps/app_agent_pool.c
index 68bcfdead..0ad24c694 100644
--- a/apps/app_agent_pool.c
+++ b/apps/app_agent_pool.c
@@ -2655,7 +2655,7 @@ static int load_module(void)
agents = ao2_container_alloc_rbtree(AO2_ALLOC_OPT_LOCK_MUTEX,
AO2_CONTAINER_ALLOC_OPT_DUPS_REPLACE, agent_pvt_sort_cmp, agent_pvt_cmp);
if (!agents) {
- return AST_MODULE_LOAD_FAILURE;
+ return AST_MODULE_LOAD_DECLINE;
}
/* Init agent holding bridge v_table. */
@@ -2679,8 +2679,9 @@ static int load_module(void)
res |= ast_register_application_xml(app_agent_request, agent_request_exec);
if (res) {
+ ast_log(LOG_ERROR, "Unable to register application. Not loading module.\n");
unload_module();
- return AST_MODULE_LOAD_FAILURE;
+ return AST_MODULE_LOAD_DECLINE;
}
if (load_config()) {
diff --git a/apps/app_alarmreceiver.c b/apps/app_alarmreceiver.c
index ace4df1dc..5b7a90c22 100644
--- a/apps/app_alarmreceiver.c
+++ b/apps/app_alarmreceiver.c
@@ -977,7 +977,7 @@ static int load_module(void)
{
if (load_config(0)) {
if (ast_register_application_xml(app, alarmreceiver_exec)) {
- return AST_MODULE_LOAD_FAILURE;
+ return AST_MODULE_LOAD_DECLINE;
}
return AST_MODULE_LOAD_SUCCESS;
}
diff --git a/apps/app_authenticate.c b/apps/app_authenticate.c
index f47db4534..30023fcc1 100644
--- a/apps/app_authenticate.c
+++ b/apps/app_authenticate.c
@@ -272,7 +272,7 @@ static int unload_module(void)
static int load_module(void)
{
if (ast_register_application_xml(app, auth_exec))
- return AST_MODULE_LOAD_FAILURE;
+ return AST_MODULE_LOAD_DECLINE;
return AST_MODULE_LOAD_SUCCESS;
}
diff --git a/apps/app_cdr.c b/apps/app_cdr.c
index 7862179f3..196179a24 100644
--- a/apps/app_cdr.c
+++ b/apps/app_cdr.c
@@ -251,7 +251,7 @@ static int load_module(void)
int res = 0;
if (!router) {
- return AST_MODULE_LOAD_FAILURE;
+ return AST_MODULE_LOAD_DECLINE;
}
res |= STASIS_MESSAGE_TYPE_INIT(appcdr_message_type);
@@ -261,7 +261,8 @@ static int load_module(void)
appcdr_callback, NULL);
if (res) {
- return AST_MODULE_LOAD_FAILURE;
+ unload_module();
+ return AST_MODULE_LOAD_DECLINE;
}
return AST_MODULE_LOAD_SUCCESS;
}
diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c
index a7fd92a37..6986fbe67 100644
--- a/apps/app_confbridge.c
+++ b/apps/app_confbridge.c
@@ -3935,7 +3935,7 @@ static int load_module(void)
if (register_channel_tech(conf_record_get_tech())
|| register_channel_tech(conf_announce_get_tech())) {
unload_module();
- return AST_MODULE_LOAD_FAILURE;
+ return AST_MODULE_LOAD_DECLINE;
}
/* Create a container to hold the conference bridges */
@@ -3943,7 +3943,7 @@ static int load_module(void)
conference_bridge_hash_cb, conference_bridge_cmp_cb);
if (!conference_bridges) {
unload_module();
- return AST_MODULE_LOAD_FAILURE;
+ return AST_MODULE_LOAD_DECLINE;
}
/* Setup manager stasis subscriptions */
@@ -3968,7 +3968,7 @@ static int load_module(void)
res |= ast_manager_register_xml("ConfbridgeSetSingleVideoSrc", EVENT_FLAG_CALL, action_confbridgesetsinglevideosrc);
if (res) {
unload_module();
- return AST_MODULE_LOAD_FAILURE;
+ return AST_MODULE_LOAD_DECLINE;
}
return AST_MODULE_LOAD_SUCCESS;
diff --git a/apps/app_dahdiras.c b/apps/app_dahdiras.c
index 51921a98e..9e7ddff84 100644
--- a/apps/app_dahdiras.c
+++ b/apps/app_dahdiras.c
@@ -225,7 +225,7 @@ static int unload_module(void)
static int load_module(void)
{
- return ((ast_register_application_xml(app, dahdiras_exec)) ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS);
+ return ((ast_register_application_xml(app, dahdiras_exec)) ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS);
}
AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "DAHDI ISDN Remote Access Server");
diff --git a/apps/app_forkcdr.c b/apps/app_forkcdr.c
index 4ff5cd610..2fd77c6ae 100644
--- a/apps/app_forkcdr.c
+++ b/apps/app_forkcdr.c
@@ -201,7 +201,7 @@ static int load_module(void)
int res = 0;
if (!router) {
- return AST_MODULE_LOAD_FAILURE;
+ return AST_MODULE_LOAD_DECLINE;
}
res |= STASIS_MESSAGE_TYPE_INIT(forkcdr_message_type);
@@ -210,7 +210,9 @@ static int load_module(void)
forkcdr_callback, NULL);
if (res) {
- return AST_MODULE_LOAD_FAILURE;
+ unload_module();
+
+ return AST_MODULE_LOAD_DECLINE;
}
return AST_MODULE_LOAD_SUCCESS;
}
diff --git a/apps/app_queue.c b/apps/app_queue.c
index f5cec1e85..1fa094efe 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -8876,7 +8876,7 @@ static int reload_queue_rules(int reload)
if (!(new_rl = ast_calloc(1, sizeof(*new_rl)))) {
AST_LIST_UNLOCK(&rule_lists);
ast_config_destroy(cfg);
- return AST_MODULE_LOAD_FAILURE;
+ return AST_MODULE_LOAD_DECLINE;
} else {
ast_copy_string(new_rl->name, rulecat, sizeof(new_rl->name));
AST_LIST_INSERT_TAIL(&rule_lists, new_rl, list);
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 34c4822f0..b0185c174 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -14976,7 +14976,7 @@ static int load_module(void)
umask(my_umask);
if (!(inprocess_container = ao2_container_alloc(573, inprocess_hash_fn, inprocess_cmp_fn))) {
- return AST_MODULE_LOAD_FAILURE;
+ return AST_MODULE_LOAD_DECLINE;
}
/* compute the location of the voicemail spool directory */
diff --git a/apps/app_zapateller.c b/apps/app_zapateller.c
index 27bcf6331..d44a2de17 100644
--- a/apps/app_zapateller.c
+++ b/apps/app_zapateller.c
@@ -134,7 +134,7 @@ static int unload_module(void)
static int load_module(void)
{
- return ((ast_register_application_xml(app, zapateller_exec)) ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS);
+ return ((ast_register_application_xml(app, zapateller_exec)) ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS);
}
AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "Block Telemarketers with Special Information Tone");