summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-01-10 23:26:12 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-01-10 23:26:12 +0100
commiteaa45e82c0e686f430bbea1ffd89a5f736d9931a (patch)
tree039ca27da5b0f97fe25371efa90ca607f0c7e083 /app/src/main/java
parentbb60a11982868f6e0234bb674f90f09346bd0dce (diff)
FileConfigStore: cleanup on rename problem
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/com/wireguard/android/configStore/FileConfigStore.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/src/main/java/com/wireguard/android/configStore/FileConfigStore.java b/app/src/main/java/com/wireguard/android/configStore/FileConfigStore.java
index 4bc7a17e..f5cd01f0 100644
--- a/app/src/main/java/com/wireguard/android/configStore/FileConfigStore.java
+++ b/app/src/main/java/com/wireguard/android/configStore/FileConfigStore.java
@@ -76,8 +76,10 @@ public final class FileConfigStore implements ConfigStore {
final File replacementFile = fileFor(replacement);
if (!replacementFile.createNewFile())
throw new IOException("Configuration for " + replacement + " already exists");
- if (!file.renameTo(replacementFile))
+ if (!file.renameTo(replacementFile)) {
+ replacementFile.delete();
throw new IOException("Cannot rename configuration file " + file.getName());
+ }
}
@Override