diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-01-10 23:26:12 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-01-10 23:26:12 +0100 |
commit | 7a618c1463341adc6d4ad0b6aa4c589cc4c0004d (patch) | |
tree | 039ca27da5b0f97fe25371efa90ca607f0c7e083 /app | |
parent | f8ee7dcce9748577aebef6677f9e6974c2dac03e (diff) |
FileConfigStore: cleanup on rename problem
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/com/wireguard/android/configStore/FileConfigStore.java | 4 |
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 |