diff options
Diffstat (limited to 'lib/util/dprintf.c')
-rw-r--r-- | lib/util/dprintf.c | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/lib/util/dprintf.c b/lib/util/dprintf.c index 376eb4c75e..90ca36c1ae 100644 --- a/lib/util/dprintf.c +++ b/lib/util/dprintf.c @@ -36,40 +36,7 @@ static int d_vfprintf(FILE *f, const char *format, va_list ap) { - char *p, *p2; - int ret; - size_t clen; - bool cret; - va_list ap2; - - va_copy(ap2, ap); - ret = vasprintf(&p, format, ap2); - va_end(ap2); - - if (ret <= 0) return ret; - - cret = convert_string_talloc(NULL, CH_UNIX, CH_DISPLAY, p, ret, (void **)&p2, &clen); - if (!cret) { - /* the string can't be converted - do the best we can, - filling in non-printing chars with '?' */ - int i; - for (i=0;i<ret;i++) { - if (isprint(p[i]) || isspace(p[i])) { - fwrite(p+i, 1, 1, f); - } else { - fwrite("?", 1, 1, f); - } - } - SAFE_FREE(p); - return ret; - } - - /* good, its converted OK */ - SAFE_FREE(p); - ret = fwrite(p2, 1, clen, f); - talloc_free(p2); - - return ret; + return vfprintf(f, format, ap); } |