Module Name:    src
Committed By:   macallan
Date:           Thu Nov 24 00:13:55 UTC 2022

Modified Files:
        src/sys/arch/powerpc/powerpc: ofw_machdep.c

Log Message:
in ofprint() only append \r if the last character is \n


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/powerpc/powerpc/ofw_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/powerpc/powerpc/ofw_machdep.c
diff -u src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.32 src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.33
--- src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.32	Thu Nov 24 00:07:48 2022
+++ src/sys/arch/powerpc/powerpc/ofw_machdep.c	Thu Nov 24 00:13:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_machdep.c,v 1.32 2022/11/24 00:07:48 macallan Exp $	*/
+/*	$NetBSD: ofw_machdep.c,v 1.33 2022/11/24 00:13:54 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2021 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.32 2022/11/24 00:07:48 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.33 2022/11/24 00:13:54 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -115,7 +115,8 @@ void ofprint(const char *blah, ...)
 	va_end(va);
 	OF_write(console_instance, buf, len);
 	/* Apple OF only does a newline on \n, so add an explicit CR */
-	OF_write(console_instance, "\r", 1);
+	if ((len > 0) && (buf[len - 1] == '\n'))
+		OF_write(console_instance, "\r", 1);
 }
 
 static int

Reply via email to