diff --git a/src/switch_apr.c b/src/switch_apr.c index e169e472a8..d19d3ccd50 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -462,9 +462,18 @@ SWITCH_DECLARE(int) switch_file_printf(switch_file_t *thefile, const char *forma { va_list ap; int ret; + char *data; + va_start(ap, format); - ret = apr_file_printf(thefile, format, ap); + + if ((ret = switch_vasprintf(&data, format, ap)) != -1) { + switch_size_t bytes = strlen(data); + switch_file_write(thefile, data, &bytes); + free(data); + } + va_end(ap); + return ret; }