From: Jan Janssen Date: Tue, 26 Oct 2021 07:56:32 +0000 (+0200) Subject: sd-boot: Save and restore console attributes X-Git-Tag: v250-rc1~355^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c86dcc39c3b7e0d4958196319d66a8aeaca19ec;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/boot/efi/util.c b/src/boot/efi/util.c index 9128c507c80..eb9745ce27d 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); }