mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-04 22:02:20 +00:00
fix(bootloader-interface): ignore invalid timeout values
A LoaderConfigTimeout or LoaderConfigTimeoutOneShot value that is not a number or a known keyword made Sprout abort boot. Log a warning and treat the variable as unset instead, matching systemd-boot.
This commit is contained in:
1 parent
48e3bc48a9
commit
df5d8f5c39
1 file changed
+9
-3
@@ -5,6 +5,7 @@ use alloc::format;
|
|||||||
use alloc::string::{String, ToString};
|
use alloc::string::{String, ToString};
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
|
use log::warn;
|
||||||
use uefi::proto::device_path::DevicePath;
|
use uefi::proto::device_path::DevicePath;
|
||||||
use uefi::{Guid, guid};
|
use uefi::{Guid, guid};
|
||||||
use uefi_raw::table::runtime::VariableVendor;
|
use uefi_raw::table::runtime::VariableVendor;
|
||||||
@@ -245,9 +246,14 @@ impl BootloaderInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse the value as a u64 to decode an numeric value.
|
// Parse the value as a u64 to decode an numeric value.
|
||||||
let value = value
|
// An invalid value is ignored, as a bad variable should not prevent booting.
|
||||||
.parse::<u64>()
|
let value = match value.parse::<u64>() {
|
||||||
.context("unable to parse timeout value")?;
|
Ok(value) => value,
|
||||||
|
Err(error) => {
|
||||||
|
warn!("ignoring invalid {} value '{}': {}", key, value, error);
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// The specification says that a value of 0 means that the menu should be hidden.
|
// The specification says that a value of 0 means that the menu should be hidden.
|
||||||
if value == 0 {
|
if value == 0 {
|
||||||
|
|||||||
Reference in new issue
Block a user