Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ hostname = { version = "^0.3", optional = true }

[features]
system = ["hostname"]
strict = []

[lib]
name = "resolv_conf"
Expand Down
6 changes: 6 additions & 0 deletions src/grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ quick_error!{
display("option at line {} is not recognized", line)
}
/// Error returned when a invalid directive is found.
#[cfg(feature="strict")]
InvalidDirective(line: usize) {
display("directive at line {} is not recognized", line)
}
Expand Down Expand Up @@ -224,7 +225,12 @@ pub(crate) fn parse(bytes: &[u8]) -> Result<Config, ParseError> {
}
}
}
#[cfg(feature="strict")]
_ => return Err(InvalidDirective(lineno)),

#[cfg(not(feature="strict"))]
_ => /* ignore invalid directives when no-strict */ (),

}
}
Ok(cfg)
Expand Down