summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/zyklonb/factoids5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/zyklonb/factoids b/plugins/zyklonb/factoids
index 00a9fbf..8bf2dc0 100755
--- a/plugins/zyklonb/factoids
+++ b/plugins/zyklonb/factoids
@@ -58,10 +58,13 @@ sub db_load {
sub db_save {
local $\ = "\n";
my ($path, $ref) = @_;
- open my $db, ">", $path or die "db save failed: $!";
+ my $path_new = "$path.new";
+ open my $db, ">", $path_new or die "db save failed: $!";
my %entries = %$ref;
print $db join "\r", ($_, @{$entries{$_}}) for keys %entries;
+ close $db;
+ rename $path_new, $path or die "db save failed: $!";
}
# --- Factoids -----------------------------------------------------------------