mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
92_FileLog.pm: avoid FHEM crash if the file cannot be opened
git-svn-id: https://svn.fhem.de/fhem/trunk@23138 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c106fbc339
commit
e822f7464e
@ -436,7 +436,7 @@ FileLog_Set($@)
|
|||||||
if(!FileLog_Switch($hash)) { # No rename, reopen anyway
|
if(!FileLog_Switch($hash)) { # No rename, reopen anyway
|
||||||
my $fh = $hash->{FH};
|
my $fh = $hash->{FH};
|
||||||
my $cn = $hash->{currentlogfile};
|
my $cn = $hash->{currentlogfile};
|
||||||
$fh->close();
|
$fh->close() if($fh);
|
||||||
if($cmd eq "clear") {
|
if($cmd eq "clear") {
|
||||||
$fh = new IO::File(">$cn");
|
$fh = new IO::File(">$cn");
|
||||||
setReadingsVal($hash, "linesInTheFile", 0, TimeNow());
|
setReadingsVal($hash, "linesInTheFile", 0, TimeNow());
|
||||||
|
Loading…
Reference in New Issue
Block a user