diff options
| author | David Lönnhager <david.l@mullvad.net> | 2020-06-12 09:15:05 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2020-06-12 09:15:05 +0200 |
| commit | 85e5da38df1a2c8ebe0aaaacf56599e7cdcbd582 (patch) | |
| tree | 325025a91a38922f3faa89260b74e17817d6c1b4 | |
| parent | c87bf21025b6ae7e58990ee23017e9fbd33ba7bd (diff) | |
| parent | bc94295f612cb319dfd69acc43473b2a81497112 (diff) | |
| download | mullvadvpn-85e5da38df1a2c8ebe0aaaacf56599e7cdcbd582.tar.xz mullvadvpn-85e5da38df1a2c8ebe0aaaacf56599e7cdcbd582.zip | |
Merge branch 'fix-null'
| -rw-r--r-- | talpid-ipc/src/win.rs | 15 |
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(()) |
