summaryrefslogtreecommitdiff
path: root/lib/console.c
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2021-09-16 16:46:55 -0400
committerPeter Jones <pjones@redhat.com>2021-10-12 10:40:13 -0400
commit35ca373d20fbeeb80aff2202077d614bc89575c0 (patch)
tree5745d9e36cc713fe06577180fadf154ec9896f8b /lib/console.c
parent1872c929cc3a466c75336307901e67917bcc46bc (diff)
downloadefi-boot-shim-35ca373d20fbeeb80aff2202077d614bc89575c0.tar.gz
efi-boot-shim-35ca373d20fbeeb80aff2202077d614bc89575c0.zip
console: add a clear_screen() primitive
Several places in e.g. MokManager and our console library use ST->ConOut->ClearScreen directly, without checking for the existence of a console output device. This patch adds function to our console library to do that correctly, instead of using the bug-prone ad hoc implementation everywhere. Signed-off-by: Peter Jones <pjones@redhat.com>
Diffstat (limited to 'lib/console.c')
-rw-r--r--lib/console.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/console.c b/lib/console.c
index 6b1e4c2f..7be5d543 100644
--- a/lib/console.c
+++ b/lib/console.c
@@ -580,7 +580,7 @@ console_mode_handle(VOID)
efi_status = co->SetMode(co, mode_set);
}
- co->ClearScreen(co);
+ clear_screen();
if (EFI_ERROR(efi_status)) {
console_error(L"Console set mode fail", efi_status);
@@ -683,6 +683,17 @@ console_reset(void)
co->ClearScreen(co);
}
+void
+clear_screen(void)
+{
+ SIMPLE_TEXT_OUTPUT_INTERFACE *co = ST->ConOut;
+
+ if (!co)
+ return;
+
+ co->ClearScreen(co);
+}
+
VOID
setup_verbosity(VOID)
{