Skip to content

Commit 31d3ffd

Browse files
committed
better handling of get_mce_kill return value
1 parent 57d7fe1 commit 31d3ffd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/sys/prctl.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,8 @@ pub fn get_mce_kill() -> Result<PrctlMCEKillPolicy> {
211211
libc::prctl(PR_MCE_KILL_GET as c_int, 0, 0, 0, 0)
212212
};
213213

214-
Errno::result(res).map(|res| PrctlMCEKillPolicy::try_from(res).unwrap())
214+
match Errno::result(res) {
215+
Ok(val) => Ok(PrctlMCEKillPolicy::try_from(val)?),
216+
Err(e) => Err(e),
217+
}
215218
}

0 commit comments

Comments
 (0)