From ec7a6757ecdff7d6680fca42aba2802bc298e21a Mon Sep 17 00:00:00 2001 From: Amadeusz Pawlik Date: Sat, 26 Oct 2019 20:06:48 +0200 Subject: Removes trailing spaces in control event log --- src/feature/control/control_events.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/feature/control/control_events.c') diff --git a/src/feature/control/control_events.c b/src/feature/control/control_events.c index 2970745ca0..57cfb0d026 100644 --- a/src/feature/control/control_events.c +++ b/src/feature/control/control_events.c @@ -1385,6 +1385,16 @@ control_event_logmsg(int severity, log_domain_mask_t domain, const char *msg) for (cp = b; *cp; ++cp) if (*cp == '\r' || *cp == '\n') *cp = ' '; + + /* Remove trailing spaces */ + for (--cp; *cp == ' ' && cp >= b; --cp) + *cp = '\0'; + + if ( cp == b ){ + ++disable_log_messages; + tor_assert_nonfatal(*b); + --disable_log_messages; + } } switch (severity) { case LOG_DEBUG: s = "DEBUG"; break; -- cgit v1.2.3-54-g00ecf