[asterisk-commits] res corosync: Add check for config file before calling coros... (asterisk[13])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Apr 23 06:30:19 CDT 2015
Matt Jordan has submitted this change and it was merged.
Change subject: res_corosync: Add check for config file before calling corosync apis
......................................................................
res_corosync: Add check for config file before calling corosync apis
On some systems, res_corosync isn't compatible with the installed version of
corosync so corosync_cfg_initialize fails, load_module returns LOAD_FAILURE,
and Asterisk terminates. The work around has been to remember to add
res_corosync as a noload in modules.conf. A better solution though is to have
res_corosync check for its config file before attempting to call corosync apis
and return LOAD_DECLINE if there's no config file. This lets Asterisk loading
continue.
If you have a res_corosync.conf file and res_corosync fails, you get the same
behavior as today and the fatal error tells you something is wrong with the
install.
ASTERISK-24998
Change-Id: Iaf94a9431a4922ec4ec994003f02135acfdd3889
---
M res/res_corosync.c
1 file changed, 6 insertions(+), 6 deletions(-)
Approvals:
Matt Jordan: Looks good to me, approved; Verified
diff --git a/res/res_corosync.c b/res/res_corosync.c
index 58290c7..e2b0596 100644
--- a/res/res_corosync.c
+++ b/res/res_corosync.c
@@ -883,6 +883,12 @@
goto failed;
}
+ if (load_config(0)) {
+ /* simply not configured is not a fatal error */
+ res = AST_MODULE_LOAD_DECLINE;
+ goto failed;
+ }
+
if ((cs_err = corosync_cfg_initialize(&cfg_handle, &cfg_callbacks)) != CS_OK) {
ast_log(LOG_ERROR, "Failed to initialize cfg: (%d)\n", (int) cs_err);
goto failed;
@@ -910,12 +916,6 @@
if (ast_pthread_create_background(&dispatch_thread.id, NULL,
dispatch_thread_handler, NULL)) {
ast_log(LOG_ERROR, "Error starting CPG dispatch thread.\n");
- goto failed;
- }
-
- if (load_config(0)) {
- /* simply not configured is not a fatal error */
- res = AST_MODULE_LOAD_DECLINE;
goto failed;
}
--
To view, visit https://gerrit.asterisk.org/223
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iaf94a9431a4922ec4ec994003f02135acfdd3889
Gerrit-PatchSet: 8
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
More information about the asterisk-commits
mailing list