fix MODAPP-145
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9597 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
6dd8d22a69
commit
117fee4f23
|
@ -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_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;
|
switch_size_t need = handle->data_len + datalen;
|
||||||
FILE *out = switch_core_get_console();
|
|
||||||
|
if (need >= handle->data_size) {
|
||||||
|
void *new_data;
|
||||||
|
need += handle->alloc_chunk;
|
||||||
|
|
||||||
if (out) {
|
if (!(new_data = realloc(handle->data, need))) {
|
||||||
nwrite = fwrite(data, datalen, 1, out);
|
return SWITCH_STATUS_MEMERR;
|
||||||
if (nwrite != datalen) {
|
|
||||||
return SWITCH_STATUS_FALSE;
|
|
||||||
}
|
}
|
||||||
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, ...)
|
SWITCH_DECLARE_NONSTD(switch_status_t) switch_console_stream_write(switch_stream_handle_t *handle, const char *fmt, ...)
|
||||||
|
|
Loading…
Reference in New Issue