From 0c260a966e1e7ac49a3e1b68b6775da53be769c0 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Fri, 13 Jul 2012 18:00:25 +0930 Subject: [PATCH] Small improvement in toprint() --- log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/log.c b/log.c index 4589ca6b..4128d7e6 100644 --- a/log.c +++ b/log.c @@ -266,7 +266,9 @@ char *toprint(char *dstStr, size_t dstChars, const unsigned char *srcBuf, size_t strbuf_puts(b, "\\r"); else if (*srcBuf == '\t') strbuf_puts(b, "\\t"); - else if (isprint(*srcBuf)) + else if (*srcBuf == '\\') + strbuf_puts(b, "\\\\"); + else if (*srcBuf >= ' ' && *srcBuf <= '~') strbuf_putc(b, *srcBuf); else strbuf_sprintf(b, "\\x%02x", *srcBuf);