From 10d8071f1cb85432b7ecfa0f97b6773287cdee0e Mon Sep 17 00:00:00 2001 From: DS_Starter Date: Sun, 20 Jul 2025 17:20:09 +0000 Subject: [PATCH] 76_SolarForecast: contrib V 1.54.4 git-svn-id: https://svn.fhem.de/fhem/trunk@30139 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/76_SolarForecast.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index a7533f812..c641e1fe2 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -5952,14 +5952,17 @@ sub __updWriteFile { open my $fh, '>:raw', $fPath or return "update ERROR open $fPath failed: $!"; my $bytes = encode ('UTF-8', $content); - print {$fh} $bytes; + my $written = syswrite $fh, $bytes; close $fh or return "update ERROR closing $fPath failed: $!"; - my $written = -s $fPath; - my $expected = strlength ($bytes); + unless (defined $written) { + return "update ERROR writing $fPath failed: $!"; + } + + my $expected = length $bytes; if ($written != $expected) { - return "update ERROR writing $fPath failed: $!"; + return sprintf "update ERROR wrote %d of %d bytes to %s", $written, $expected, $fPath; } return;