[commit] r6535 - in freeswitch/trunk/src: . include
Author: mikej Date: Thu Dec 6 08:40:00 2007 New Revision: 6535 Modified: freeswitch/trunk/src/include/switch_core.h freeswitch/trunk/src/switch.c freeswitch/trunk/src/switch_core.c freeswitch/trunk/src/switch_log.c Log: only set console when we have a console Modified: freeswitch/trunk/src/include/switch_core.h ============================================================================== --- freeswitch/trunk/src/include/switch_core.h (original) +++ freeswitch/trunk/src/include/switch_core.h Thu Dec 6 08:40:00 2007 @@ -242,7 +242,7 @@ \param err a pointer to set any errors to \note to be called at application startup */ -SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, const char **err); +SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switch_bool_t console, const char **err); /*! \brief Initilize the core and load modules @@ -251,7 +251,7 @@ \param err a pointer to set any errors to \note to be called at application startup instead of switch_core_init. Includes module loading. */ -SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t flags, const char **err); +SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t flags, switch_bool_t console, const char **err); /*! \brief Set/Get Session Limit Modified: freeswitch/trunk/src/switch.c ============================================================================== --- freeswitch/trunk/src/switch.c (original) +++ freeswitch/trunk/src/switch.c Thu Dec 6 08:40:00 2007 @@ -180,7 +180,7 @@ set_high_priority(); /* attempt to initialize freeswitch and load modules */ - if (switch_core_init_and_modload(flags, &err) != SWITCH_STATUS_SUCCESS) { + if (switch_core_init_and_modload(flags, SWITCH_FALSE, &err) != SWITCH_STATUS_SUCCESS) { /* freeswitch did not start sucessfully */ status.dwCurrentState = SERVICE_STOPPED; } else { @@ -416,7 +416,7 @@ } #endif - if (switch_core_init_and_modload(flags, &err) != SWITCH_STATUS_SUCCESS) { + if (switch_core_init_and_modload(flags, nc ? SWITCH_FALSE : SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { fprintf(stderr, "Cannot Initilize [%s]\n", err); return 255; } Modified: freeswitch/trunk/src/switch_core.c ============================================================================== --- freeswitch/trunk/src/switch_core.c (original) +++ freeswitch/trunk/src/switch_core.c Thu Dec 6 08:40:00 2007 @@ -641,7 +641,7 @@ } -SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, const char **err) +SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switch_bool_t console, const char **err) { switch_xml_t xml = NULL, cfg = NULL; switch_uuid_t uuid; @@ -743,7 +743,9 @@ *err = NULL; - runtime.console = stdout; + if (console) { + runtime.console = stdout; + } assert(runtime.memory_pool != NULL); switch_log_init(runtime.memory_pool); @@ -808,10 +810,10 @@ if (sig); return; } -SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t flags, const char **err) +SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t flags, switch_bool_t console, const char **err) { switch_event_t *event; - if (switch_core_init(flags, err) != SWITCH_STATUS_SUCCESS) { + if (switch_core_init(flags, console, err) != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_GENERR; } Modified: freeswitch/trunk/src/switch_log.c ============================================================================== --- freeswitch/trunk/src/switch_log.c (original) +++ freeswitch/trunk/src/switch_log.c Thu Dec 6 08:40:00 2007 @@ -247,7 +247,9 @@ } } else { if (level == SWITCH_LOG_CONSOLE || !LOG_QUEUE || !THREAD_RUNNING) { - fprintf(handle, "%s", data); + if (handle) { + fprintf(handle, "%s", data); + } free(data); } else if (level <= MAX_LEVEL) { switch_log_node_t *node;
participants (1)
-
Freeswitch SVN