diff options
author | mogorman <mogorman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-08-31 21:00:20 +0000 |
---|---|---|
committer | mogorman <mogorman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-08-31 21:00:20 +0000 |
commit | 73925ee14a02afb50f6c0aea3cc4e54f99493440 (patch) | |
tree | 5eac7fd790352b502dbbc4fc21ae517fe7c388ad /cdr | |
parent | 43c75db33e757e08cdec37b1713a0e275d9a039b (diff) |
everything that loads a config that needs a config file to run
now reports AST_MODULE_LOAD_DECLINE when loading if config file
is not there, also fixed an error in res_config_pgsql where it
had a non static function when it should.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@41633 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cdr')
-rw-r--r-- | cdr/cdr_csv.c | 9 | ||||
-rw-r--r-- | cdr/cdr_custom.c | 5 | ||||
-rw-r--r-- | cdr/cdr_manager.c | 8 | ||||
-rw-r--r-- | cdr/cdr_odbc.c | 1 | ||||
-rw-r--r-- | cdr/cdr_pgsql.c | 2 | ||||
-rw-r--r-- | cdr/cdr_radius.c | 3 | ||||
-rw-r--r-- | cdr/cdr_tds.c | 7 |
7 files changed, 22 insertions, 13 deletions
diff --git a/cdr/cdr_csv.c b/cdr/cdr_csv.c index a599fb08f..5e88563b7 100644 --- a/cdr/cdr_csv.c +++ b/cdr/cdr_csv.c @@ -108,13 +108,13 @@ static int load_config(void) if (!cfg) { ast_log(LOG_WARNING, "unable to load config: %s\n", config); - return -1; + return 0; } var = ast_variable_browse(cfg, "csv"); if (!var) { ast_config_destroy(cfg); - return -1; + return 0; } tmp = ast_variable_retrieve(cfg, "csv", "usegmtime"); @@ -142,7 +142,7 @@ static int load_config(void) } ast_config_destroy(cfg); - return 0; + return 1; } static int append_string(char *buf, char *s, size_t bufsize) @@ -321,7 +321,8 @@ static int load_module(void) { int res; - load_config(); + if(!load_config()) + return AST_MODULE_LOAD_DECLINE; res = ast_cdr_register(name, ast_module_info->description, csv_log); if (res) { diff --git a/cdr/cdr_custom.c b/cdr/cdr_custom.c index e89f022d0..803c3d9b7 100644 --- a/cdr/cdr_custom.c +++ b/cdr/cdr_custom.c @@ -153,8 +153,9 @@ static int load_module(void) ast_log(LOG_ERROR, "Unable to register custom CDR handling\n"); if (mf) fclose(mf); - } - return res; + return res; + } else + return AST_MODULE_LOAD_DECLINE; } static int reload(void) diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index 07406734d..4e43a30ff 100644 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -49,7 +49,7 @@ static char *name = "cdr_manager"; static int enablecdr = 0; -static void loadconfigurationfile(void) +static int loadconfigurationfile(void) { char *cat; struct ast_config *cfg; @@ -59,7 +59,7 @@ static void loadconfigurationfile(void) if (!cfg) { /* Standard configuration */ enablecdr = 0; - return; + return 0; } cat = ast_category_browse(cfg, NULL); @@ -80,6 +80,7 @@ static void loadconfigurationfile(void) } ast_config_destroy(cfg); + return 1; } static int manager_log(struct ast_cdr *cdr) @@ -145,7 +146,8 @@ static int load_module(void) int res; /* Configuration file */ - loadconfigurationfile(); + if(loadconfigurationfile()) + return AST_MODULE_LOAD_DECLINE; res = ast_cdr_register(name, "Asterisk Manager Interface CDR Backend", manager_log); if (res) { diff --git a/cdr/cdr_odbc.c b/cdr/cdr_odbc.c index 51d77a140..18ba1654d 100644 --- a/cdr/cdr_odbc.c +++ b/cdr/cdr_odbc.c @@ -253,6 +253,7 @@ static int odbc_load_module(void) cfg = ast_config_load(config); if (!cfg) { ast_log(LOG_WARNING, "cdr_odbc: Unable to load config for ODBC CDR's: %s\n", config); + res = AST_MODULE_LOAD_DECLINE; goto out; } diff --git a/cdr/cdr_pgsql.c b/cdr/cdr_pgsql.c index f477584b5..500554cc1 100644 --- a/cdr/cdr_pgsql.c +++ b/cdr/cdr_pgsql.c @@ -289,7 +289,7 @@ static int my_load_module(void) if (!(cfg = ast_config_load(config))) { ast_log(LOG_WARNING, "Unable to load config for PostgreSQL CDR's: %s\n", config); - return 0; + return AST_MODULE_LOAD_DECLINE; } res = process_my_load_module(cfg); diff --git a/cdr/cdr_radius.c b/cdr/cdr_radius.c index ac59d4bd1..dbbdd1715 100644 --- a/cdr/cdr_radius.c +++ b/cdr/cdr_radius.c @@ -247,7 +247,8 @@ static int load_module(void) if ((tmp = ast_variable_retrieve(cfg, "radius", "radiuscfg"))) ast_copy_string(radiuscfg, tmp, sizeof(radiuscfg)); ast_config_destroy(cfg); - } + } else + return AST_MODULE_LOAD_DECLINE; /* start logging */ rc_openlog("asterisk"); diff --git a/cdr/cdr_tds.c b/cdr/cdr_tds.c index 868768e64..07bb17752 100644 --- a/cdr/cdr_tds.c +++ b/cdr/cdr_tds.c @@ -504,8 +504,11 @@ static int reload(void) } static int load_module(void) -{ - return tds_load_module(); + + if(!tds_load_module()) + return AST_MODULE_LOAD_DECLINE; + else + return AST_MODULE_LOAD_SUCCESS; } static int unload_module(void) |