diff options
Diffstat (limited to 'lib/Smokeping/Master.pm')
-rw-r--r-- | lib/Smokeping/Master.pm | 8 |
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"; } |