Re: 2.1.31: Odd display of SCSI devices during boot

Kohtala Marko (Marko.Kohtala@ntc.nokia.com)
07 Apr 1997 22:19:26 +0300


I got busy with my daytime job at a bad time, but here is another
patch I deviced during a break at work, totally untested. It fixes one
more slight bug, than my previous patch.

Notice that the patch by Mr. Pavel is wrong since it references past
the message buffer.

diff -up linux/kernel/printk.c.orig linux/kernel/printk.c
--- linux/kernel/printk.c.orig Sat Apr 5 23:14:20 1997
+++ linux/kernel/printk.c Mon Apr 7 22:11:41 1997
@@ -176,6 +176,7 @@ asmlinkage int printk(const char *fmt, .
va_list args;
int i;
char *msg, *p, *buf_end;
+ int line_feed;
static signed char msg_level = -1;
long flags;

@@ -202,6 +203,7 @@ asmlinkage int printk(const char *fmt, .
msg += 3;
msg_level = p[1] - '0';
}
+ line_feed = 0;
for (; p < buf_end; p++) {
log_buf[(log_start+log_size) & (LOG_BUF_LEN-1)] = *p;
if (log_size < LOG_BUF_LEN)
@@ -211,18 +213,20 @@ asmlinkage int printk(const char *fmt, .
log_start &= LOG_BUF_LEN-1;
}
logged_chars++;
- if (*p == '\n')
+ if (*p == '\n') {
+ line_feed = 1;
break;
+ }
}
if (msg_level < console_loglevel && console_drivers) {
struct console *c = console_drivers;
while(c) {
if (c->write)
- c->write(msg, p - msg + 1);
+ c->write(msg, p - msg + line_feed);
c = c->next;
}
}
- if (*p == '\n')
+ if (line_feed)
msg_level = -1;
}
__restore_flags(flags);

Diff finished at Mon Apr 7 22:13:02

-- 
---
Marko Kohtala - Marko.Kohtala@ntc.nokia.com, Marko.Kohtala@hut.fi