summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-03-05 17:00:08 -0300
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-03-06 14:06:22 -0300
commit90673322cd85d8026f4557cc9762bd7b61448927 (patch)
tree07f6b856b05004317452e0e2d425872b5d4686b5
parentc4330e821e496f3e1ffb4282a1c99795d9329e50 (diff)
downloadmullvadvpn-90673322cd85d8026f4557cc9762bd7b61448927.tar.xz
mullvadvpn-90673322cd85d8026f4557cc9762bd7b61448927.zip
Ignore rename error if log file doesn't exist
The file is moved only to create a backup of it. If it doesn't exist, there is no need to create the backup, so the error can be safely ignored.
-rw-r--r--mullvad-daemon/src/main.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/mullvad-daemon/src/main.rs b/mullvad-daemon/src/main.rs
index f4a033e5f0..50fc5d1991 100644
--- a/mullvad-daemon/src/main.rs
+++ b/mullvad-daemon/src/main.rs
@@ -660,10 +660,12 @@ impl Daemon {
backup.set_extension("old.log");
fs::rename(file, backup).unwrap_or_else(|error| {
- warn!(
- "Failed to create backup of previous tunnel log file ({})",
- error
- );
+ if error.kind() != io::ErrorKind::NotFound {
+ warn!(
+ "Failed to create backup of previous tunnel log file ({})",
+ error
+ );
+ }
});
fs::File::create(file).chain_err(|| "Unable to create the tunnel log file")?;