Skip to content

Commit

Permalink
Merge pull request stanislav-tkach#303 from martintc/fix-issue-300
Browse files Browse the repository at this point in the history
Fix issue 300
  • Loading branch information
stanislav-tkach authored Apr 24, 2022
2 parents e4b685e + 30874b6 commit 36c19ad
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
16 changes: 9 additions & 7 deletions os_info/src/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,21 @@ fn get_os() -> Type {
.output()
.expect("Failed to get OS");

match str::from_utf8(&os.stdout).unwrap() {
"FreeBSD\n" => {
match str::from_utf8(&os.stdout) {
Ok("FreeBSD\n") => {
let check_hardening = Command::new("sysctl")
.arg("hardening.version")
.output()
.expect("Failed to check if is hardened");
match str::from_utf8(&check_hardening.stderr).unwrap() {
"" => return Type::HardenedBSD,
_ => return Type::FreeBSD,
match str::from_utf8(&check_hardening.stderr) {
Ok("0\n") => return Type::HardenedBSD,
Ok(_) => return Type::Unknown,
Err(_) => return Type::FreeBSD,
}
}
"MidnightBSD\n" => Type::MidnightBSD,
_ => Type::Unknown,
Ok("MidnightBSD\n") => Type::MidnightBSD,
Ok(_) => Type::Unknown,
Err(_) => Type::Unknown,
}
}

Expand Down
2 changes: 1 addition & 1 deletion os_info/src/linux/file_release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const DISTRIBUTIONS: [ReleaseInfo; 6] = [
os_type: Type::Mariner,
path: "/etc/mariner-release",
version_matcher: Matcher::PrefixedVersion {
prefix: "CBL-Mariner "
prefix: "CBL-Mariner ",
},
},
ReleaseInfo {
Expand Down
1 change: 0 additions & 1 deletion os_info/src/linux/lsb_release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ mod tests {
assert_eq!(parse_results.codename, Some("Mariner".to_string()));
}


#[test]
fn endeavouros() {
let parse_results = parse(endeavouros_file());
Expand Down

0 comments on commit 36c19ad

Please sign in to comment.