From 55860cace76f47b11fc9889261bd3d4e5950a787 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 7 Oct 2018 14:46:21 +0100 Subject: [PATCH] log_proxy_stderr: cope with CRLF on proxy stderr lines. The CR was getting as far as GTK, where it caused a formatting oddity in the Event Log list box. It should be stripped along with the LF. --- be_misc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/be_misc.c b/be_misc.c index 86a7e739..55853411 100644 --- a/be_misc.c +++ b/be_misc.c @@ -91,6 +91,8 @@ void log_proxy_stderr(Plug *plug, bufchain *buf, const void *vdata, int len) msg = snewn(msglen+1, char); bufchain_fetch(buf, msg, msglen); bufchain_consume(buf, msglen); + while (msglen > 0 && (msg[msglen-1] == '\n' || msg[msglen-1] == '\r')) + msglen--; msg[msglen] = '\0'; fullmsg = dupprintf("proxy: %s", msg); plug_log(plug, 2, NULL, 0, fullmsg, 0);