Re: printk: what is going on with additional newlines?

Sergey Senozhatsky
2017-08-28T12:38:10Z

On (08/28/17 21:21), Sergey Senozhatsky wrote:
> how about something like this?
>

...ok, definetely breaks the

KERN_ERR "foo"; KERN_CONT "bar"; KERN_CONT "bar"; KERN_CONT "\n";

case. um... something like this then?

---

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index fc47863f629c..098e280e9fe0 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1670,10 +1670,11 @@ static size_t log_output(int facility, int level, enum log_flags lflags, const c
* write from the same process, try to add it to the buffer.
*/
if (cont.len) {
- if (cont.owner == current && (lflags & LOG_CONT)) {
+ if (cont.owner == current &&
+ ((cont.level == level) ||
+ (lflags & LOG_CONT)))
if (cont_add(facility, level, lflags, text, text_len))
return text_len;
- }
/* Otherwise, make sure it's flushed */
cont_flush();
}