From: Willy Tarreau Date: Thu, 12 Mar 2009 07:18:33 +0000 (+0100) Subject: [MINOR] show errors: encode backslash as well as non-ascii characters X-Git-Tag: v1.3.16~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=787bbd9b7a6ce7364d3fa726ef50069294cd5316;p=thirdparty%2Fhaproxy.git [MINOR] show errors: encode backslash as well as non-ascii characters These ones were not properly encoded, causing confusion on the output. --- diff --git a/src/dumpstats.c b/src/dumpstats.c index f81dc7c8a9..990e51f894 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -1262,11 +1262,11 @@ static int dump_error_line(struct chunk *out, int size, while (ptr < err->len) { c = err->buf[ptr]; - if (isprint(c)) { + if (isprint(c) && isascii(c) && c != '\\') { if (out->len > end - 2) break; out->str[out->len++] = c; - } else if (c == '\t' || c == '\n' || c == '\r' || c == '\e') { + } else if (c == '\t' || c == '\n' || c == '\r' || c == '\e' || c == '\\') { if (out->len > end - 3) break; out->str[out->len++] = '\\'; @@ -1275,6 +1275,7 @@ static int dump_error_line(struct chunk *out, int size, case '\n': c = 'n'; break; case '\r': c = 'r'; break; case '\e': c = 'e'; break; + case '\\': c = '\\'; break; } out->str[out->len++] = c; } else {