summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2020-06-12 09:15:05 +0200
committerDavid Lönnhager <david.l@mullvad.net>2020-06-12 09:15:05 +0200
commit85e5da38df1a2c8ebe0aaaacf56599e7cdcbd582 (patch)
tree325025a91a38922f3faa89260b74e17817d6c1b4
parentc87bf21025b6ae7e58990ee23017e9fbd33ba7bd (diff)
parentbc94295f612cb319dfd69acc43473b2a81497112 (diff)
downloadmullvadvpn-85e5da38df1a2c8ebe0aaaacf56599e7cdcbd582.tar.xz
mullvadvpn-85e5da38df1a2c8ebe0aaaacf56599e7cdcbd582.zip
Merge branch 'fix-null'
-rw-r--r--talpid-ipc/src/win.rs15
1 files changed, 4 insertions, 11 deletions
diff --git a/talpid-ipc/src/win.rs b/talpid-ipc/src/win.rs
index a555a652f9..0b39282348 100644
--- a/talpid-ipc/src/win.rs
+++ b/talpid-ipc/src/win.rs
@@ -71,7 +71,8 @@ impl Drop for WinHandle {
}
pub fn deny_network_access<T: AsRef<OsStr>>(ipc_path: T) -> Result<(), io::Error> {
- let ipc_w: Vec<_> = ipc_path.as_ref().encode_wide().collect();
+ let mut ipc_w: Vec<_> = ipc_path.as_ref().encode_wide().collect();
+ ipc_w.push(0u16);
let pipe_handle = unsafe {
CreateFileW(
@@ -142,11 +143,7 @@ pub fn deny_network_access<T: AsRef<OsStr>>(ipc_path: T) -> Result<(), io::Error
)
};
if result != ERROR_SUCCESS {
- // A non-zero error code in WinError.h
- return Err(io::Error::new(
- io::ErrorKind::Other,
- format!("SetEntriesInAclW failed: {}", result),
- ));
+ return Err(io::Error::from_raw_os_error(result as i32));
}
let result = unsafe {
@@ -164,11 +161,7 @@ pub fn deny_network_access<T: AsRef<OsStr>>(ipc_path: T) -> Result<(), io::Error
unsafe { LocalFree(new_dacl as *mut _) };
if result != ERROR_SUCCESS {
- // A non-zero error code in WinError.h
- return Err(io::Error::new(
- io::ErrorKind::Other,
- format!("SetSecurityInfo failed: {}", result),
- ));
+ return Err(io::Error::from_raw_os_error(result as i32));
}
Ok(())