mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-16 21:31:46 +00:00
Revert "proxmox: add SysError::is_errno_raw"
Not actually required, the numbers just overlapped and are
therefore no separate enum entry.
This reverts commit 8f57f29ca8
.
This commit is contained in:
parent
8f57f29ca8
commit
341795c1ee
@ -55,13 +55,7 @@ pub fn io_err_other<E: ToString>(e: E) -> io::Error {
|
||||
/// ```
|
||||
pub trait SysError {
|
||||
/// Check if this error is a specific error returned from a system call.
|
||||
fn is_errno(&self, value: Errno) -> bool {
|
||||
self.is_errno_raw(value as i32)
|
||||
}
|
||||
|
||||
/// Check if this error is a specific error returned from a system call, without involving the
|
||||
/// `nix::errno::Errno` type as it is incomplete.
|
||||
fn is_errno_raw(&self, value: i32) -> bool;
|
||||
fn is_errno(&self, value: Errno) -> bool;
|
||||
|
||||
/// Convert this error into a `std::io::Error`. This must use the correct `std::io::ErrorKind`,
|
||||
/// so that for example `ErrorKind::WouldBlock` means that the previous system call failed with
|
||||
@ -89,8 +83,8 @@ pub trait SysError {
|
||||
|
||||
impl SysError for io::Error {
|
||||
#[inline]
|
||||
fn is_errno_raw(&self, value: i32) -> bool {
|
||||
self.raw_os_error() == Some(value)
|
||||
fn is_errno(&self, value: Errno) -> bool {
|
||||
self.raw_os_error() == Some(value as i32)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -105,14 +99,6 @@ impl SysError for nix::Error {
|
||||
*self == Error::Sys(value)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_errno_raw(&self, value: i32) -> bool {
|
||||
match *self {
|
||||
Error::Sys(errno) => value == errno as i32,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn into_io_error(self) -> io::Error {
|
||||
match self {
|
||||
|
Loading…
Reference in New Issue
Block a user