shithub: riscv

Download patch

ref: 36dc22fd5713cca65bbe31eb7d7a5a6d6b034637
parent: a03d9a7985c7a2a6e72c997921c6fa4e73cddaca
author: cinap_lenrek <cinap_lenrek@centraldogma>
date: Tue Dec 13 11:07:52 EST 2011

panic(): dont print message twice. for terminals, dont auto reboot.

--- a/sys/src/9/port/devcons.c
+++ b/sys/src/9/port/devcons.c
@@ -240,7 +240,7 @@
 void
 panic(char *fmt, ...)
 {
-	int n, s;
+	int s;
 	va_list arg;
 	char buf[PRINTSIZE];
 
@@ -253,7 +253,7 @@
 	s = splhi();
 	strcpy(buf, "panic: ");
 	va_start(arg, fmt);
-	n = vseprint(buf+strlen(buf), buf+sizeof(buf), fmt, arg) - buf;
+	vseprint(buf+strlen(buf), buf+sizeof(buf), fmt, arg);
 	va_end(arg);
 	iprint("%s\n", buf);
 	if(consdebug)
@@ -260,10 +260,9 @@
 		(*consdebug)();
 	splx(s);
 	prflush();
-	buf[n] = '\n';
-	putstrn(buf, n+1);
 	dumpstack();
-
+	if(!cpuserver)
+		for(;;);
 	exit(1);
 }