mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
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: https://origsvn.digium.com/svn/asterisk/trunk@41633 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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) {
|
||||
|
@@ -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)
|
||||
|
@@ -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) {
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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");
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user