summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2019-02-15 07:33:52 +0000
committerintrigeri <intrigeri@boum.org>2019-02-15 07:33:52 +0000
commit85e56d07b8eab9b1b79338547284b16471193c06 (patch)
tree1ea697b97799dbe40f20e5d1e7f7355d854077aa
parentf168d062c245105ceb67c4c1e7ea1a3fe2f9332c (diff)
Don't backup an empty persistence.conf (refs: #16461)
This could overwrite a non-empty backup.
-rw-r--r--lib/Tails/Persistence/Configuration/ConfigFile.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Tails/Persistence/Configuration/ConfigFile.pm b/lib/Tails/Persistence/Configuration/ConfigFile.pm
index 5dd5b2b..27237f7 100644
--- a/lib/Tails/Persistence/Configuration/ConfigFile.pm
+++ b/lib/Tails/Persistence/Configuration/ConfigFile.pm
@@ -85,7 +85,9 @@ Throw exception on error.
=cut
method save () {
my $config_file_was_empty = ! -s $self->config_file_path;
- $self->config_file_path->copy($self->config_file_path . '.bak');
+ unless ($config_file_was_empty) {
+ $self->config_file_path->copy($self->config_file_path . '.bak');
+ }
$self->config_file_path->spew($self->output);
$self->config_file_path->chmod(0600);
# Ensure our changes land on the disk