summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTobi Oetiker <tobi@oetiker.ch>2008-08-30 15:09:37 +0200
committerTobi Oetiker <tobi@oetiker.ch>2008-08-30 15:09:37 +0200
commit09a4089d927f4c63fdab1b8bded2a73ac398d412 (patch)
tree784a6bb6c6d226227703557455acbaa5fd28b800 /lib
parentae5a24062aec7a5eeb2e984989dc3a9ba84e5560 (diff)
downloadsmokeping-09a4089d927f4c63fdab1b8bded2a73ac398d412.tar.gz
smokeping-09a4089d927f4c63fdab1b8bded2a73ac398d412.tar.xz
properly fix the handling of multiple writes to the cache file
Diffstat (limited to 'lib')
-rw-r--r--lib/Smokeping/Master.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Smokeping/Master.pm b/lib/Smokeping/Master.pm
index e2c50fd..1a12427 100644
--- a/lib/Smokeping/Master.pm
+++ b/lib/Smokeping/Master.pm
@@ -1,7 +1,7 @@
# -*- perl -*-
package Smokeping::Master;
use Data::Dumper;
-use Storable qw(nstore_fd dclone fd_retrieve);
+use Storable qw(nstore dclone fd_retrieve);
use strict;
use warnings;
use Fcntl qw(:flock);
@@ -143,8 +143,8 @@ sub save_updates {
map {
push @{$existing}, [ $slave, $_->[0], $_->[1] ];
} @{$u{$name}};
- seek $fh, 0, 0;
- nstore_fd($existing, $fh);
+ nstore($existing, $file.$$);
+ rename $file.$$,$file;
flock($fh, LOCK_UN);
close $fh;
last;