From 14678d54c10070ec80d06547c0873521da0c95f0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 21 Sep 2011 15:35:47 -0500 Subject: [PATCH] fix switch_file_printf --- src/switch_apr.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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; }