diff options
author | George Joseph <george.joseph@fairview5.com> | 2015-04-22 15:22:10 -0600 |
---|---|---|
committer | Matt Jordan <mjordan@digium.com> | 2015-04-23 06:30:29 -0500 |
commit | cc77440debadb2ac0f45074f9a399d8c1d18c7fa (patch) | |
tree | 25474e9c81142914d881fb011b87086f0fcdfd32 /res/res_corosync.c | |
parent | 0722e11f2686c00ace3de11e1a27ceff03f49ff1 (diff) |
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
Diffstat (limited to 'res/res_corosync.c')
-rw-r--r-- | res/res_corosync.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/res/res_corosync.c b/res/res_corosync.c index 6e7372742..0b3a61f62 100644 --- a/res/res_corosync.c +++ b/res/res_corosync.c @@ -883,6 +883,12 @@ static int load_module(void) 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; @@ -913,12 +919,6 @@ static int load_module(void) goto failed; } - if (load_config(0)) { - /* simply not configured is not a fatal error */ - res = AST_MODULE_LOAD_DECLINE; - goto failed; - } - ast_cli_register_multiple(corosync_cli, ARRAY_LEN(corosync_cli)); return AST_MODULE_LOAD_SUCCESS; |