summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2019-04-26 13:20:12 +0000
committerintrigeri <intrigeri@boum.org>2019-04-26 13:20:12 +0000
commitb111137caf01c84e15db39f82799e68a044b76f1 (patch)
treeec1b729013cfce7f64701018c90304687c4d7246
parenta3a442e77deb60c798542b3654b57a24de278a29 (diff)
Make writing persistence.conf.bak more robustbugfix/16568-more-robust-backup
In exactly the same way as what we did recently for persistence.conf in the "save" method, let's do our best to ensure the persistence.conf.bak backup file is actually written to disk, regardless of what may happen later (e.g. unclear shutdown).
-rw-r--r--lib/Tails/Persistence/Configuration/ConfigFile.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Tails/Persistence/Configuration/ConfigFile.pm b/lib/Tails/Persistence/Configuration/ConfigFile.pm
index aebff9e..6fc63eb 100644
--- a/lib/Tails/Persistence/Configuration/ConfigFile.pm
+++ b/lib/Tails/Persistence/Configuration/ConfigFile.pm
@@ -96,6 +96,11 @@ Copy the on-disk configuration file to a backup file.
method backup () {
$self->config_file_path->copy($self->backup_config_file_path);
$self->backup_config_file_path->chmod(0600);
+ # Ensure our changes land on the disk
+ systemx('sync', $self->backup_config_file_path->stringify);
+ # Ensure changes made elsewhere are written synchronously on the disk
+ # (in case something else ever needs to modify this file)
+ systemx('chattr', '+S', $self->backup_config_file_path->stringify);
}
=head2 save