[asterisk-commits] kmoore: trunk r391689 - /trunk/main/cel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 13 13:20:33 CDT 2013


Author: kmoore
Date: Thu Jun 13 13:20:31 2013
New Revision: 391689

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391689
Log:
Ensure that Asterisk still starts up when cel.conf is missing

Modified:
    trunk/main/cel.c

Modified: trunk/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/cel.c?view=diff&rev=391689&r1=391688&r2=391689
==============================================================================
--- trunk/main/cel.c (original)
+++ trunk/main/cel.c Thu Jun 13 13:20:31 2013
@@ -477,10 +477,6 @@
 	struct ast_event_sub *sub;
 	RAII_VAR(struct cel_config *, cfg, ao2_global_obj_ref(cel_configs), ao2_cleanup);
 
-	if (!cfg || !cfg->general) {
-		return CLI_FAILURE;
-	}
-
 	switch (cmd) {
 	case CLI_INIT:
 		e->command = "cel show status";
@@ -500,6 +496,10 @@
 
 	ast_cli(a->fd, "CEL Logging: %s\n", ast_cel_check_enabled() ? "Enabled" : "Disabled");
 
+	if (!cfg || !cfg->general) {
+		return CLI_SUCCESS;
+	}
+
 	if (!cfg->general->enable) {
 		return CLI_SUCCESS;
 	}
@@ -611,7 +611,7 @@
 
 static int do_reload(void)
 {
-	if (aco_process_config(&cel_cfg_info, 1)) {
+	if (aco_process_config(&cel_cfg_info, 1) == ACO_PROCESS_ERROR) {
 		return -1;
 	}
 
@@ -1444,19 +1444,6 @@
 		return -1;
 	}
 
-	if (aco_info_init(&cel_cfg_info)) {
-		return -1;
-	}
-
-	aco_option_register(&cel_cfg_info, "enable", ACO_EXACT, general_options, "no", OPT_BOOL_T, 1, FLDSET(struct cel_general_config, enable));
-	aco_option_register(&cel_cfg_info, "dateformat", ACO_EXACT, general_options, "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct cel_general_config, date_format));
-	aco_option_register_custom(&cel_cfg_info, "apps", ACO_EXACT, general_options, "", apps_handler, 0);
-	aco_option_register_custom(&cel_cfg_info, "events", ACO_EXACT, general_options, "", events_handler, 0);
-
-	if (aco_process_config(&cel_cfg_info, 0)) {
-		return -1;
-	}
-
 	if (ast_cli_register(&cli_status)) {
 		return -1;
 	}
@@ -1530,6 +1517,17 @@
 		return -1;
 	}
 
+	if (aco_info_init(&cel_cfg_info)) {
+		return -1;
+	}
+
+	aco_option_register(&cel_cfg_info, "enable", ACO_EXACT, general_options, "no", OPT_BOOL_T, 1, FLDSET(struct cel_general_config, enable));
+	aco_option_register(&cel_cfg_info, "dateformat", ACO_EXACT, general_options, "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct cel_general_config, date_format));
+	aco_option_register_custom(&cel_cfg_info, "apps", ACO_EXACT, general_options, "", apps_handler, 0);
+	aco_option_register_custom(&cel_cfg_info, "events", ACO_EXACT, general_options, "", events_handler, 0);
+
+	aco_process_config(&cel_cfg_info, 0);
+
 	ast_register_cleanup(ast_cel_engine_term);
 
 	return 0;




More information about the asterisk-commits mailing list