From 441d1fe53008898441eddc9289b2e0148bf351d1 Mon Sep 17 00:00:00 2001 From: Tobi Oetiker Date: Thu, 20 Dec 2007 23:25:04 +0000 Subject: make this work even when no initial file is here --- lib/Smokeping/Master.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/Smokeping/Master.pm') diff --git a/lib/Smokeping/Master.pm b/lib/Smokeping/Master.pm index efe1d9a..945cb78 100644 --- a/lib/Smokeping/Master.pm +++ b/lib/Smokeping/Master.pm @@ -105,11 +105,12 @@ sub save_updates { " in the local data structure. Make sure you run the ". "smokeping daemon. ($cfg->{General}{datadir})\n"; } - elsif ( open (my $hand, '+<', $file) ) { + elsif ( open ($hand, '+>>' , $file) ) { for (my $i = 10; $i < 0; $i--){ if ( flock $hand, LOCK_EX ){ my $existing = []; if ( (stat($hand))[7] > 0 ){ + seek $hand, 0,0; eval { $existing = fd_retrieve $hand }; if ($@) { #error warn "Loading $file: $@"; -- cgit v1.2.3-24-g4f1b