Skip to content

Commit

Permalink
better handling of get_mce_kill return value
Browse files Browse the repository at this point in the history
  • Loading branch information
DOhlsson committed Mar 27, 2022
1 parent 57d7fe1 commit 31d3ffd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/sys/prctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,8 @@ pub fn get_mce_kill() -> Result<PrctlMCEKillPolicy> {
libc::prctl(PR_MCE_KILL_GET as c_int, 0, 0, 0, 0)
};

Errno::result(res).map(|res| PrctlMCEKillPolicy::try_from(res).unwrap())
match Errno::result(res) {
Ok(val) => Ok(PrctlMCEKillPolicy::try_from(val)?),
Err(e) => Err(e),
}
}

0 comments on commit 31d3ffd

Please sign in to comment.