92_FileLog.pm: better switch for readonly files

git-svn-id: https://svn.fhem.de/fhem/trunk@10007 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2015-11-26 14:05:29 +00:00
parent 2575689ea3
commit b036d2f6ff

View File

@ -147,6 +147,8 @@ FileLog_Switch($)
my $cn = ResolveDateWildcards($log->{logfile}, @t); my $cn = ResolveDateWildcards($log->{logfile}, @t);
if($cn ne $log->{currentlogfile}) { # New logfile if($cn ne $log->{currentlogfile}) { # New logfile
$log->{currentlogfile} = $cn;
return 1 if($log->{READONLY});
$fh->close() if($fh); $fh->close() if($fh);
HandleArchiving($log); HandleArchiving($log);
$fh = new IO::File ">>$cn"; $fh = new IO::File ">>$cn";
@ -154,7 +156,6 @@ FileLog_Switch($)
Log3 $log, 0, "Can't open $cn"; Log3 $log, 0, "Can't open $cn";
return 0; return 0;
} }
$log->{currentlogfile} = $cn;
$log->{FH} = $fh; $log->{FH} = $fh;
return 1; return 1;
} }