mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
dd: exit when bs/ibs/obs/cbs isn't positive
This commit is contained in:
committed by
Sylvestre Ledru
parent
36265cb9ee
commit
4be5eb9f24
@@ -320,8 +320,12 @@ impl Parser {
|
||||
}
|
||||
|
||||
fn parse_bytes(arg: &str, val: &str) -> Result<usize, ParseError> {
|
||||
parse_bytes_with_opt_multiplier(val)?
|
||||
.try_into()
|
||||
let num = parse_bytes_with_opt_multiplier(val)?;
|
||||
|
||||
if num == 0 {
|
||||
return Err(ParseError::InvalidNumber(val.to_string()));
|
||||
}
|
||||
num.try_into()
|
||||
.map_err(|_| ParseError::BsOutOfRange(arg.to_string()))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user