summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Janssen <medhefgo@web.de>2021-10-26 09:56:32 +0200
committerJan Janssen <medhefgo@web.de>2021-11-04 18:37:07 +0100
commit3c86dcc39c3b7e0d4958196319d66a8aeaca19ec (patch)
tree26bd2903db2396089b7d27e73f2993edc614b0ae
parentMerge pull request #21070 from medhefgo/boot-save (diff)
downloadsystemd-3c86dcc39c3b7e0d4958196319d66a8aeaca19ec.tar.xz
systemd-3c86dcc39c3b7e0d4958196319d66a8aeaca19ec.zip
sd-boot: Save and restore console attributes
This also only writes the message on a new line if we aren't at the beginning of one already.
-rw-r--r--src/boot/efi/util.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/boot/efi/util.c b/src/boot/efi/util.c
index 9128c507c8..eb9745ce27 100644
--- a/src/boot/efi/util.c
+++ b/src/boot/efi/util.c
@@ -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);
}