use std::io;
fn feature_errno(errno: Option<i32>) -> bool {
matches!(
errno,
Some(libc::ENOPROTOOPT)
| Some(libc::EOPNOTSUPP)
| Some(libc::EINVAL)
| Some(libc::EPERM)
| Some(libc::EACCES)
)
}
pub fn feature_error(err: io::Error, label: &'static str) -> io::Error {
if feature_errno(err.raw_os_error()) {
io::Error::new(io::ErrorKind::Unsupported, label)
} else {
err
}
}