summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEmīls Piņķis <emils@mullvad.net>2019-03-07 12:59:59 +0000
committerEmīls Piņķis <emils@mullvad.net>2019-03-07 14:20:25 +0000
commit5e2abe9c518a4c1689f3d8d1c7b6728b2ac5c5cb (patch)
tree68561bf19425c91ddb4712fb414d77f8343393f4
parent5624b12fe0089074f5c845521f0e7eb915074220 (diff)
downloadmullvadvpn-5e2abe9c518a4c1689f3d8d1c7b6728b2ac5c5cb.tar.xz
mullvadvpn-5e2abe9c518a4c1689f3d8d1c7b6728b2ac5c5cb.zip
Open wireguard log file in write-only mode instead of read-only mode
-rw-r--r--talpid-core/src/tunnel/wireguard/wireguard_go.rs14
1 files changed, 3 insertions, 11 deletions
diff --git a/talpid-core/src/tunnel/wireguard/wireguard_go.rs b/talpid-core/src/tunnel/wireguard/wireguard_go.rs
index 556819a6d8..e713a4a190 100644
--- a/talpid-core/src/tunnel/wireguard/wireguard_go.rs
+++ b/talpid-core/src/tunnel/wireguard/wireguard_go.rs
@@ -1,8 +1,5 @@
use super::{Config, ErrorKind, Result, ResultExt, Tunnel};
-use crate::{
- logging,
- network_interface::{NetworkInterface, TunnelDevice},
-};
+use crate::network_interface::{NetworkInterface, TunnelDevice};
use std::{ffi::CString, fs, os::unix::io::AsRawFd, path::Path};
@@ -80,13 +77,8 @@ impl Drop for WgGoTunnel {
}
fn prepare_log_file(log_path: Option<&Path>) -> Result<fs::File> {
- match log_path {
- Some(path) => {
- logging::rotate_log(path).chain_err(|| ErrorKind::PrepareLogFileError)?;
- fs::File::open(&path).chain_err(|| ErrorKind::PrepareLogFileError)
- }
- None => fs::File::open("/dev/null").chain_err(|| ErrorKind::PrepareLogFileError),
- }
+ fs::File::create(log_path.unwrap_or("/dev/null".as_ref()))
+ .chain_err(|| ErrorKind::PrepareLogFileError)
}
impl Tunnel for WgGoTunnel {