FileConfigStore: cleanup on rename problem
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
f8ee7dcce9
commit
7a618c1463
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user