Skip to content

Commit fe714cc

Browse files
committed
fix(filesystem-device-match): bail early if no criteria is provided
1 parent 000e3ea commit fe714cc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/extractors/filesystem_device_match.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@ pub fn extract(
8888
context: Rc<SproutContext>,
8989
extractor: &FilesystemDeviceMatchExtractor,
9090
) -> Result<String> {
91+
// If no criteria are provided, bail with an error.
92+
if extractor.has_label.is_none()
93+
&& extractor.has_item.is_none()
94+
&& extractor.has_partition_uuid.is_none()
95+
&& extractor.has_partition_type_uuid.is_none()
96+
{
97+
bail!("at least one criteria is required for filesystem-device-match");
98+
}
99+
91100
// Find all the filesystems inside the UEFI stack.
92101
let handles = uefi::boot::find_handles::<SimpleFileSystem>()
93102
.context("unable to find filesystem handles")?;

0 commit comments

Comments
 (0)