Skip to content

Commit

Permalink
Fix FreeBSD's get_os uname's pattern matching
Browse files Browse the repository at this point in the history
The previous code would lead to compilation error on the latest
FreeBSD (14.0) release. Both with the rust pkg (version 1.72), as well
as with the latest stable compiler (version 1.76).

Compilation error was about mismatched types, with the pattern match
branches being Option<&str>, when a &str was currently expected.
Compiler's advised fix was to wrap the branch patterns in a `Some`,
which was done in this commit.
  • Loading branch information
oleiade committed Mar 18, 2024
1 parent 702bc94 commit 7495397
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions os_info/src/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ pub fn current_platform() -> Info {

fn get_os() -> Type {
match uname("-r").as_deref() {
"MidnightBSD" => Type::MidnightBSD,
"FreeBSD" => {
Some("MidnightBSD") => Type::MidnightBSD,
Some("FreeBSD") => {
let check_hardening = match Command::new("/sbin/sysctl")
.arg("hardening.version")
.output()
Expand Down

0 comments on commit 7495397

Please sign in to comment.