From 54fee799a7693f4164f2df7acf3c34ab29752abf Mon Sep 17 00:00:00 2001 From: Andrey Dyldin Date: Mon, 8 Mar 2021 16:57:12 +0200 Subject: [PATCH] fix --- src/ca/mod.rs | 7 ++----- src/fe/mod.rs | 3 +-- src/net/mod.rs | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/ca/mod.rs b/src/ca/mod.rs index 424c16e..28874eb 100644 --- a/src/ca/mod.rs +++ b/src/ca/mod.rs @@ -7,9 +7,6 @@ pub mod sys; use { std::{ - path::{ - Path, - }, fs::{ File, OpenOptions, @@ -102,8 +99,8 @@ impl CaDevice { .read(true) .write(true) .custom_flags(::nix::libc::O_NONBLOCK) - .open(path) - .with_context(|| format!("CA: failed to open device {}", path.display()))?; + .open(&path) + .with_context(|| format!("CA: failed to open device {}", &path))?; let mut ca = CaDevice { adapter, diff --git a/src/fe/mod.rs b/src/fe/mod.rs index 2c282c8..80bc487 100644 --- a/src/fe/mod.rs +++ b/src/fe/mod.rs @@ -21,7 +21,6 @@ use { RawFd, }, }, - path::Path, }, anyhow::{ @@ -177,7 +176,7 @@ impl FeDevice { .write(!readonly) .custom_flags(::nix::libc::O_NONBLOCK) .open(&path) - .context("FE: open")?; + .with_context(|| format!("FE: failed to open device {}", &path))?; let mut fe = FeDevice { adapter, diff --git a/src/net/mod.rs b/src/net/mod.rs index 5db7acb..0c44bce 100644 --- a/src/net/mod.rs +++ b/src/net/mod.rs @@ -64,7 +64,7 @@ impl NetDevice { .write(true) .custom_flags(::nix::libc::O_NONBLOCK) .open(&path) - .context("NET: open")?; + .with_context(|| format!("NET: failed to open device {}", &path))?; let net = NetDevice { adapter,