From 4639978b3ac062cdc1811bfd6237f3680921b220 Mon Sep 17 00:00:00 2001 From: Tomasz Gajewski Date: Wed, 1 Apr 2020 00:39:24 +0200 Subject: [PATCH] trace_logger: avoid output of empty lines It avoids output of empty lines in output buffer if traced messages end with \n (what is common with messages logged from dde_linux). Issue #3714 --- repos/os/src/app/trace_logger/monitor.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/repos/os/src/app/trace_logger/monitor.cc b/repos/os/src/app/trace_logger/monitor.cc index 8145ed1f8..775641275 100644 --- a/repos/os/src/app/trace_logger/monitor.cc +++ b/repos/os/src/app/trace_logger/monitor.cc @@ -124,6 +124,10 @@ void Monitor::print(bool activity, bool affinity) memcpy(_curr_entry_data, entry.data(), length); _curr_entry_data[length] = '\0'; + /* avoid output of empty lines due to end of line character at end */ + if (_curr_entry_data[length - 1] == '\n') + _curr_entry_data[length - 1] = '\0'; + /* print copied entry data out to log */ if (!printed_buf_entries) { log(" ");