fix MODAPP-145

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9597 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-09-19 15:46:53 +00:00
parent 6dd8d22a69
commit 117fee4f23
1 changed files with 16 additions and 8 deletions

View File

@ -87,18 +87,26 @@ static switch_status_t console_xml_config(void)
SWITCH_DECLARE_NONSTD(switch_status_t) switch_console_stream_raw_write(switch_stream_handle_t *handle, uint8_t *data, switch_size_t datalen)
{
switch_size_t nwrite;
FILE *out = switch_core_get_console();
switch_size_t need = handle->data_len + datalen;
if (need >= handle->data_size) {
void *new_data;
need += handle->alloc_chunk;
if (out) {
nwrite = fwrite(data, datalen, 1, out);
if (nwrite != datalen) {
return SWITCH_STATUS_FALSE;
if (!(new_data = realloc(handle->data, need))) {
return SWITCH_STATUS_MEMERR;
}
return SWITCH_STATUS_SUCCESS;
handle->data = new_data;
handle->data_size = need;
}
return SWITCH_STATUS_FALSE;
memcpy((uint8_t *) (handle->data) + handle->data_len, data, datalen);
handle->data_len += datalen;
handle->end = (uint8_t *) (handle->data) + handle->data_len;
handle->end = NULL;
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE_NONSTD(switch_status_t) switch_console_stream_write(switch_stream_handle_t *handle, const char *fmt, ...)