From 0a68e34b0f31871c2ed84ab2d55f509ea4d9a9ba Mon Sep 17 00:00:00 2001 From: mulhern Date: Mon, 16 Dec 2024 10:15:34 -0500 Subject: [PATCH] Return parser error on non-numeric value for integrity journal size Signed-off-by: mulhern --- src/bin/utils/cmds.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bin/utils/cmds.rs b/src/bin/utils/cmds.rs index f3dfc9ae4f..58ce808de0 100644 --- a/src/bin/utils/cmds.rs +++ b/src/bin/utils/cmds.rs @@ -98,6 +98,7 @@ pool is encrypted, setting this option has no effect on the prediction."), Arg::new("integrity_journal_size") .long("integrity-journal-size") .num_args(1) + .value_parser(clap::value_parser!(u64)) .help("Size of the integrity journal. Default is 128 MiB. Units are bytes.") .next_line_help(true) ), @@ -141,9 +142,8 @@ impl<'a> UtilCommand<'a> for StratisPredictUsage { .get_many::("filesystem-size") .map(|szs| szs.map(|n| Bytes(*n)).collect::>()), sub_m - .get_one::("integrity_journal_size") - .map(|s| s.parse::().map(Bytes::from)) - .transpose()? + .get_one::("integrity_journal_size") + .map(|n| Bytes::from(*n)) .map(|b| { if b % 4096u64 != Bytes(0) { Err(format!("Value {b} is not aligned to 4096"))