2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-19 18:56:03 +00:00

rereadcfg reports uninitialized when 99*.pm is buggy

git-svn-id: https://svn.fhem.de/fhem/trunk@1604 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2012-06-07 06:22:00 +00:00
parent 48b43f7c9e
commit 95e45d492a

View File

@ -81,7 +81,7 @@ sub fhem($);
sub fhz($); sub fhz($);
sub IsDummy($); sub IsDummy($);
sub IsIgnored($); sub IsIgnored($);
sub setGlobalAttrBeforeFork(); sub setGlobalAttrBeforeFork($);
sub redirectStdinStdErr(); sub redirectStdinStdErr();
sub setReadingsVal($$$$); sub setReadingsVal($$$$);
sub addEvent($$); sub addEvent($$);
@ -310,7 +310,7 @@ doGlobalDef($ARGV[0]);
# As newer Linux versions reset serial parameters after fork, we parse the # As newer Linux versions reset serial parameters after fork, we parse the
# config file after the fork. Since need some global attr parameters before, we # config file after the fork. Since need some global attr parameters before, we
# read them here. # read them here.
setGlobalAttrBeforeFork(); setGlobalAttrBeforeFork($attr{global}{configfile});
if($^O =~ m/Win/ && !$attr{global}{nofork}) { if($^O =~ m/Win/ && !$attr{global}{nofork}) {
Log 1, "Forcing 'attr global nofork' on WINDOWS"; Log 1, "Forcing 'attr global nofork' on WINDOWS";
@ -970,6 +970,7 @@ CommandRereadCfg($$)
%readyfnlist = (); %readyfnlist = ();
doGlobalDef($cfgfile); doGlobalDef($cfgfile);
setGlobalAttrBeforeFork($cfgfile);
my $ret = CommandInclude($cl, $cfgfile); my $ret = CommandInclude($cl, $cfgfile);
if($attr{global}{statefile} && -r $attr{global}{statefile}) { if($attr{global}{statefile} && -r $attr{global}{statefile}) {
@ -2647,9 +2648,9 @@ ReplaceEventMap($$$)
} }
sub sub
setGlobalAttrBeforeFork() setGlobalAttrBeforeFork($)
{ {
my $f = $attr{global}{configfile}; my ($f) = @_;
open(FH, $f) || die("Cant open $f: $!\n"); open(FH, $f) || die("Cant open $f: $!\n");
while(my $l = <FH>) { while(my $l = <FH>) {
$l =~ s/[\r\n]//g; $l =~ s/[\r\n]//g;