git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1545 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2006-06-05 18:36:02 +00:00
parent e9563fbf5d
commit 5337872ce8
3 changed files with 17 additions and 13 deletions

View File

@@ -2758,9 +2758,8 @@ SWITCH_DECLARE(void) switch_core_set_globals(void)
#endif
}
SWITCH_DECLARE(switch_status_t) switch_core_init(char *console)
SWITCH_DECLARE(switch_status_t) switch_core_init(char *console, const char **err)
{
const char *err = NULL;
memset(&runtime, 0, sizeof(runtime));
switch_core_set_globals();
@@ -2768,29 +2767,35 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(char *console)
/* INIT APR and Create the pool context */
if (apr_initialize() != SWITCH_STATUS_SUCCESS) {
apr_terminate();
fprintf(stderr, "FATAL ERROR! Could not initilize APR\n");
*err = "FATAL ERROR! Could not initilize APR\n";
return SWITCH_STATUS_MEMERR;
}
if (apr_pool_create(&runtime.memory_pool, NULL) != SWITCH_STATUS_SUCCESS) {
apr_terminate();
fprintf(stderr, "FATAL ERROR! Could not allocate memory pool\n");
*err = "FATAL ERROR! Could not allocate memory pool\n";
return SWITCH_STATUS_MEMERR;
}
if (switch_xml_init(runtime.memory_pool, &err) != SWITCH_STATUS_SUCCESS) {
if (switch_xml_init(runtime.memory_pool, err) != SWITCH_STATUS_SUCCESS) {
apr_terminate();
fprintf(stderr, "FATAL ERROR! Could not open XML Registry %s\n", err);
*err = "FATAL ERROR! Could not open XML Registry %s\n";
return SWITCH_STATUS_MEMERR;
}
*err = NULL;
if(console) {
if (*console != '/') {
char path[265];
snprintf(path, sizeof(path), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, console);
console = path;
}
switch_core_set_console(console);
if (switch_core_set_console(console) != SWITCH_STATUS_SUCCESS) {
*err = "FATAL ERROR! Could not open console\n";
apr_terminate();
return SWITCH_STATUS_GENERR;
}
} else {
runtime.console = stdout;
}