tools/systemd/parse_time: error out on invalid ranges
if the range is reverse (bigger..smaller) we will never find a value, so error out during parsing Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
07ca6f6e66
commit
ce7ab28cfa
@ -145,6 +145,9 @@ fn parse_date_time_comp(max: usize) -> impl Fn(&str) -> IResult<&str, DateTimeVa
|
||||
let (i, value) = parse_time_comp(max)(i)?;
|
||||
|
||||
if let (i, Some(end)) = opt(preceded(tag(".."), parse_time_comp(max)))(i)? {
|
||||
if value > end {
|
||||
return Err(parse_error(i, "range start is bigger than end"));
|
||||
}
|
||||
return Ok((i, DateTimeValue::Range(value, end)))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user