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:57:21 -0600
commit747beb1ed159f89a3b58742e4257740b3d6d6bba (patch)
tree3ba17dd62d0270a9ee976f173f948304b1733773 /apps
parent60fd01f7f4b43515f5d4d915eec701c6054c53cf (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 9d73702f6..6d485d6fb 100644
--- a/apps/app_adsiprog.c
+++ b/apps/app_adsiprog.c
@@ -1605,7 +1605,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 4563b58a0..2e0c8e880 100644
--- a/apps/app_agent_pool.c
+++ b/apps/app_agent_pool.c
@@ -2653,7 +2653,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. */
@@ -2677,8 +2677,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 2169617ac..07885d2bf 100644
--- a/apps/app_alarmreceiver.c
+++ b/apps/app_alarmreceiver.c
@@ -975,7 +975,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 f58ed3626..e0ad4a089 100644
--- a/apps/app_authenticate.c
+++ b/apps/app_authenticate.c
@@ -270,7 +270,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 17dea431d..1500c89f6 100644
--- a/apps/app_cdr.c
+++ b/apps/app_cdr.c
@@ -249,7 +249,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);
@@ -259,7 +259,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 5ec20ddb9..a9f917b9a 100644
--- a/apps/app_confbridge.c
+++ b/apps/app_confbridge.c
@@ -3955,7 +3955,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 */
@@ -3963,7 +3963,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 */
@@ -3988,7 +3988,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 6eaa1bd22..10c2962c6 100644
--- a/apps/app_dahdiras.c
+++ b/apps/app_dahdiras.c
@@ -223,7 +223,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 acd8982ef..5946c5009 100644
--- a/apps/app_forkcdr.c
+++ b/apps/app_forkcdr.c
@@ -199,7 +199,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);
@@ -208,7 +208,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 ae2d645e9..2389f0b13 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -8892,7 +8892,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 aebaafaf3..de826704a 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -14974,7 +14974,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 e876a70a8..f62f7bb50 100644
--- a/apps/app_zapateller.c
+++ b/apps/app_zapateller.c
@@ -132,7 +132,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");