From c3e883c121c6237cf9d1cedc7ebdf57c273c7eec Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Thu, 30 Oct 2025 23:42:47 -0400 Subject: [PATCH] fix(utils): when retrieving the partition guid, if the guid is zero, return none --- src/utils.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils.rs b/src/utils.rs index b65a240..91bdfd4 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -201,12 +201,15 @@ pub fn unique_hash(input: &str) -> String { /// Represents the type of partition GUID that can be retrieved. #[derive(PartialEq, Eq)] pub enum PartitionGuidForm { + /// The partition GUID is the unique partition GUID. Partition, + /// The partition GUID is the partition type GUID. PartitionType, } /// Retrieve the partition / partition type GUID of the device root `path`. /// This only works on GPT partitions. If the root is not a GPT partition, None is returned. +/// If the GUID is all zeros, this will return None. pub fn partition_guid(path: &DevicePath, form: PartitionGuidForm) -> Result> { // Clone the path so we can pass it to the UEFI stack. let path = path.to_boxed(); @@ -238,7 +241,8 @@ pub fn partition_guid(path: &DevicePath, form: PartitionGuidForm) -> Result entry.unique_partition_guid, PartitionGuidForm::PartitionType => entry.partition_type_guid.0, - })) + }) + .filter(|guid| !guid.is_zero())) } else { Ok(None) }