diff options
Diffstat (limited to 'include/trace/events/printk.h')
-rw-r--r-- | include/trace/events/printk.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/include/trace/events/printk.h b/include/trace/events/printk.h index c008bc9..f350170 100644 --- a/include/trace/events/printk.h +++ b/include/trace/events/printk.h @@ -16,8 +16,16 @@ TRACE_EVENT(console, ), TP_fast_assign( - memcpy(__get_dynamic_array(msg), text, len); - ((char *)__get_dynamic_array(msg))[len] = 0; + /* + * Each trace entry is printed in a new line. + * If the msg finishes with '\n', cut it off + * to avoid blank lines in the trace. + */ + if ((len > 0) && (text[len-1] == '\n')) + len -= 1; + + memcpy(__get_str(msg), text, len); + __get_str(msg)[len] = 0; ), TP_printk("%s", __get_str(msg)) |