lanzaboote: handle errors in print_logo

This commit is contained in:
Julian Stecklina 2022-11-25 18:08:54 +01:00
parent 6bc66052c2
commit 3779e81b20
1 changed files with 9 additions and 10 deletions

View File

@ -17,7 +17,7 @@ use uefi::{
loaded_image::LoadedImage,
media::file::{File, FileAttribute, FileMode, RegularFile},
},
CString16, Error,
CString16, Result,
};
use crate::{
@ -25,11 +25,11 @@ use crate::{
uefi_helpers::{booted_image_cmdline, booted_image_file, read_all},
};
fn print_logo(output: &mut Output) {
output.clear().unwrap();
/// Print the startup logo on boot.
fn print_logo(output: &mut Output) -> Result<()> {
output.clear()?;
output
.output_string(cstr16!(
output.output_string(cstr16!(
"
_ _ _\r
| | | | | |\r
@ -40,7 +40,6 @@ fn print_logo(output: &mut Output) {
\r
"
))
.unwrap();
}
/// The configuration that is embedded at build time.
@ -59,7 +58,7 @@ struct EmbeddedConfiguration {
}
impl EmbeddedConfiguration {
fn new(file: &mut RegularFile) -> Result<Self, Error> {
fn new(file: &mut RegularFile) -> Result<Self> {
file.set_position(0)?;
let file_data = read_all(file)?;
@ -79,7 +78,7 @@ impl EmbeddedConfiguration {
fn main(handle: Handle, mut system_table: SystemTable<Boot>) -> Status {
uefi_services::init(&mut system_table).unwrap();
print_logo(system_table.stdout());
print_logo(system_table.stdout()).unwrap();
let config: EmbeddedConfiguration =
EmbeddedConfiguration::new(&mut booted_image_file(system_table.boot_services()).unwrap())