Print the raw errno if it is not an expected value

This commit is contained in:
LI Qing 2022-11-07 10:52:35 +08:00 committed by volcano
parent 3c11d589f4
commit 70d3bf690c

@ -194,7 +194,10 @@ impl Errno {
impl From<u32> for Errno { impl From<u32> for Errno {
fn from(raw_errno: u32) -> Self { fn from(raw_errno: u32) -> Self {
assert!(ERRNO_MIN <= raw_errno && raw_errno <= ERRNO_MAX); if raw_errno < ERRNO_MIN || raw_errno > ERRNO_MAX {
error!("unexpected raw errno: {}", raw_errno);
panic!();
}
unsafe { core::mem::transmute(raw_errno as u8) } unsafe { core::mem::transmute(raw_errno as u8) }
} }
} }