2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-25 03:44:52 +00:00

74_AutomowerConnect: Common.pm: replace 'die' statement.

git-svn-id: https://svn.fhem.de/fhem/trunk@28619 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Ellert 2024-03-08 22:33:45 +00:00
parent 3176af5ff9
commit da786370c6

View File

@ -2083,21 +2083,36 @@ sub readMap {
if ( $filename and -e $filename ) {
open my $fh, '<:raw', $filename or die $!;
my $content = '';
if ( open my $fh, '<:raw', $filename ) {
while (1) {
my $content = '';
my $success = read $fh, $content, 1024, length($content);
die $! if not defined $success;
last if not $success;
while (1) {
my $success = read $fh, $content, 1024, length( $content );
if ( not defined $success ) {
close $fh;
Log3 $name, 1, "$iam read file \"$filename\" with error $!";
return;
}
last if not $success;
}
close $fh;
$hash->{helper}{MAP_CACHE} = $content;
Log3 $name, 4, "$iam file \"$filename\" content length: ".length( $content );
} else {
Log3 $name, 1, "$iam open file \"$filename\" with error $!";
}
close $fh;
$hash->{helper}{MAP_CACHE} = $content;
Log3 $name, 5, "$iam file \"$filename\" content length: ".length($content);
} else {
Log3 $name, 2, "$iam file \"$filename\" does not exist.";