]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-boot: Save and restore console attributes
authorJan Janssen <medhefgo@web.de>
Tue, 26 Oct 2021 07:56:32 +0000 (09:56 +0200)
committerJan Janssen <medhefgo@web.de>
Thu, 4 Nov 2021 17:37:07 +0000 (18:37 +0100)
This also only writes the message on a new line if we aren't at the
beginning of one already.

src/boot/efi/util.c

index 9128c507c803f31dbf1c3d80cfc2d7fe245074ff..eb9745ce27d6a990d10066da5c7af87c4ee606c4 100644 (file)
@@ -493,14 +493,21 @@ void log_error_stall(const CHAR16 *fmt, ...) {
 
         assert(fmt);
 
+        INT32 attr = ST->ConOut->Mode->Attribute;
         ST->ConOut->SetAttribute(ST->ConOut, EFI_LIGHTRED|EFI_BACKGROUND_BLACK);
 
-        Print(L"\n");
+        if (ST->ConOut->Mode->CursorColumn > 0)
+                Print(L"\n");
+
         va_start(args, fmt);
         VPrint(fmt, args);
         va_end(args);
+
         Print(L"\n");
 
+        ST->ConOut->SetAttribute(ST->ConOut, attr);
+
+        /* Give the user a chance to see the message. */
         BS->Stall(3 * 1000 * 1000);
 }