summaryrefslogtreecommitdiffstats
path: root/lib/Smokeping/Master.pm
diff options
context:
space:
mode:
authorTobi Oetiker <tobi@oetiker.ch>2007-08-23 22:58:01 +0200
committerTobi Oetiker <tobi@oetiker.ch>2007-08-23 22:58:01 +0200
commit3f641e37b99d5aa18ecf2f58364696ac17f859d2 (patch)
treee6c7ea35a0c23004f12e6faee627f250fd734027 /lib/Smokeping/Master.pm
parented8e591272fa1c7ca012db03b45568ec81ff9cfd (diff)
downloadsmokeping-3f641e37b99d5aa18ecf2f58364696ac17f859d2.tar.gz
smokeping-3f641e37b99d5aa18ecf2f58364696ac17f859d2.tar.xz
* improved handling of slave updates
* added median/sdev to graphs
Diffstat (limited to 'lib/Smokeping/Master.pm')
-rw-r--r--lib/Smokeping/Master.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Smokeping/Master.pm b/lib/Smokeping/Master.pm
index 10333a8..ddd708e 100644
--- a/lib/Smokeping/Master.pm
+++ b/lib/Smokeping/Master.pm
@@ -139,14 +139,14 @@ sub get_slaveupdates {
my $data;
if ( open (my $hand, '<', $file) ) {
if ( flock $hand, LOCK_EX ){
- eval { $data = fd_retrieve $hand };
+ rename $file,$file.$$;
+ eval { $data = fd_retrieve $hand };
+ unlink $file.$$;
+ flock $hand, LOCK_UN;
if ($@) { #error
warn "Loading $file: $@";
return;
}
- seek $hand, 0,0;
- truncate $hand, 0;
- flock $hand, LOCK_UN;
} else {
warn "Could not lock $file. Can't load data.\n";
}