Don't overwrite the static panicstr buffer for secondary and further
panics. Before revision 1.38, we used to just point panicstr at the format string if panicstr was NULL, but since we now use a static buffer for the formatted panic message, we have to be careful to only write to it during the first panic. Pointed out by: bde
This commit is contained in:
parent
e6811cdce9
commit
6fb682520c
@ -507,11 +507,16 @@ panic(const char *fmt, ...)
|
||||
}
|
||||
|
||||
va_start(ap, fmt);
|
||||
(void)vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||
if (panicstr == fmt)
|
||||
if (newpanic) {
|
||||
(void)vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||
panicstr = buf;
|
||||
printf("panic: %s\n", buf);
|
||||
} else {
|
||||
printf("panic: ");
|
||||
vprintf(fmt, ap);
|
||||
printf("\n");
|
||||
}
|
||||
va_end(ap);
|
||||
printf("panic: %s\n", buf);
|
||||
#ifdef SMP
|
||||
/* two separate prints in case of an unmapped page and trap */
|
||||
printf("cpuid = %d; ", PCPU_GET(cpuid));
|
||||
|
Loading…
Reference in New Issue
Block a user