Deny 'block' as unit for --block-size

This commit is contained in:
merkrafter authored and David Peter committed 2021-11-14 09:26:21 +01:00
1 parent 1b1fc4b053
commit 825100c6d6
1 file changed
+5
+5
View File
@@ -148,6 +148,11 @@ fn run() -> Result<(), AnyhowError> {
.value_of("block_size")
.map(|bs| {
let (num, unit) = extract_num_and_unit_from(bs)?;
if let Unit::Block { custom_size: _ } = unit {
return Err(anyhow!(
"can not use 'block(s)' as a unit to specify block size"
));
};
num.checked_mul(unit.get_multiplier())
.ok_or_else(|| anyhow!(ByteOffsetParseError::UnitMultiplicationOverflow))
.and_then(|x| {