[tor-commits] [tor/master] Removes trailing spaces in control event log

asn at torproject.org asn at torproject.org
Tue Nov 3 14:07:08 UTC 2020


commit ec7a6757ecdff7d6680fca42aba2802bc298e21a
Author: Amadeusz Pawlik <apawlik at protonmail.com>
Date:   Sat Oct 26 20:06:48 2019 +0200

    Removes trailing spaces in control event log
---
 src/feature/control/control_events.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

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;





More information about the tor-commits mailing list