Skip to content

Commit

Permalink
Merge branch 'remove-errno-dependency'
Browse files Browse the repository at this point in the history
  • Loading branch information
faern committed Jun 3, 2024
2 parents 8548959 + 5609300 commit 60448b1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 39 deletions.
38 changes: 2 additions & 36 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ travis-ci = { repository = "mullvad/pfctl-rs" }


[dependencies]
errno = "0.2"
error-chain = "0.12.4"
ioctl-sys = "0.6.0"
libc = "0.2.29"
Expand Down
6 changes: 4 additions & 2 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ macro_rules! ioctl_guard {
};
($func:expr, $already_active:expr) => {
if unsafe { $func } == $crate::macros::IOCTL_ERROR {
let ::errno::Errno(error_code) = ::errno::errno();
let io_error = ::std::io::Error::from_raw_os_error(error_code);
let io_error = ::std::io::Error::last_os_error();
let error_code = io_error
.raw_os_error()
.expect("Errors created with last_os_error should have errno");
let mut err = Err($crate::ErrorKind::IoctlError(io_error).into());
if error_code == $already_active {
err = err.chain_err(|| $crate::ErrorKind::StateAlreadyActive);
Expand Down

0 comments on commit 60448b1

Please sign in to comment.