summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2021-07-05 10:51:42 +0200
committerDavid Lönnhager <david.l@mullvad.net>2021-07-05 13:50:02 +0200
commit6bf69ae07991f43a86b7be9cae631031508dce7b (patch)
tree04361c221eb601346cd07802afa68595014dbfb7
parente3c8238243a7202856637014bbf3d6007545ba72 (diff)
downloadmullvadvpn-6bf69ae07991f43a86b7be9cae631031508dce7b.tar.xz
mullvadvpn-6bf69ae07991f43a86b7be9cae631031508dce7b.zip
Skip excluded paths with non-existent drive letters
-rw-r--r--talpid-core/src/split_tunnel/windows/driver.rs14
-rw-r--r--talpid-core/src/split_tunnel/windows/windows.rs9
2 files changed, 14 insertions, 9 deletions
diff --git a/talpid-core/src/split_tunnel/windows/driver.rs b/talpid-core/src/split_tunnel/windows/driver.rs
index feb60dbc88..7f097f9e54 100644
--- a/talpid-core/src/split_tunnel/windows/driver.rs
+++ b/talpid-core/src/split_tunnel/windows/driver.rs
@@ -19,6 +19,7 @@ use std::{
ptr,
time::Duration,
};
+use talpid_types::ErrorExt;
use winapi::{
shared::{
in6addr::IN6_ADDR,
@@ -265,7 +266,18 @@ impl DeviceHandle {
pub fn set_config<T: AsRef<OsStr>>(&self, apps: &[T]) -> io::Result<()> {
let mut device_paths = Vec::with_capacity(apps.len());
for app in apps.as_ref() {
- device_paths.push(get_device_path(app.as_ref())?);
+ match get_device_path(app.as_ref()) {
+ Err(error) if error.kind() == io::ErrorKind::NotFound => {
+ log::warn!(
+ "{}\nPath: {}",
+ error
+ .display_chain_with_msg("Skipping path with non-existent drive letter"),
+ app.as_ref().to_string_lossy()
+ );
+ }
+ Err(error) => return Err(error),
+ Ok(path) => device_paths.push(path),
+ }
}
log::debug!("Excluded device paths:");
diff --git a/talpid-core/src/split_tunnel/windows/windows.rs b/talpid-core/src/split_tunnel/windows/windows.rs
index b706a73203..3163244c5f 100644
--- a/talpid-core/src/split_tunnel/windows/windows.rs
+++ b/talpid-core/src/split_tunnel/windows/windows.rs
@@ -107,20 +107,13 @@ impl Iterator for ProcessSnapshotEntries<'_> {
/// Obtains a device path without resolving links or mount points.
pub fn get_device_path<T: AsRef<Path>>(path: T) -> Result<OsString, io::Error> {
- if !path.as_ref().is_absolute() {
- return Err(io::Error::new(
- io::ErrorKind::InvalidInput,
- "path must be absolute",
- ));
- }
-
let drive_comp = path.as_ref().components().next();
let drive = match drive_comp {
Some(std::path::Component::Prefix(prefix)) => prefix.as_os_str(),
_ => {
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
- "invalid drive label",
+ "path must be absolute",
))
}
};