From 4c40644f9b10ae954c87afce769977478c8bcb83 Mon Sep 17 00:00:00 2001 From: tpoitzsch <> Date: Sat, 7 Feb 2015 16:50:34 +0000 Subject: [PATCH] FRITZBOX: Handles error: No STDOUT from shell command git-svn-id: https://svn.fhem.de/fhem/trunk@7904 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/72_FRITZBOX.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fhem/FHEM/72_FRITZBOX.pm b/fhem/FHEM/72_FRITZBOX.pm index dab445667..21d35e4a7 100644 --- a/fhem/FHEM/72_FRITZBOX.pm +++ b/fhem/FHEM/72_FRITZBOX.pm @@ -788,6 +788,7 @@ sub FRITZBOX_Readout_Run($) for (1..$fonCount) { push @readoutCmdArray, ["fon".$_, "ctlmgr_ctl r telcfg settings/MSN/Port".($_-1)."/Name" ]; + push @readoutCmdArray, ["fon".$_."_out", "ctlmgr_ctl r telcfg settings/MSN/Port".($_-1)."/MSN" ]; } $resultArray = FRITZBOX_Readout_Query( $hash, \@readoutCmdArray, \@readoutReadings ); @@ -795,7 +796,7 @@ sub FRITZBOX_Readout_Run($) for (1..$fonCount) { push @readoutReadings, "fon".$_."_intern|".$_ - if $resultArray->[$_-1]; + if $resultArray->[($_-1)*2]; } # Prepare new command array @@ -2284,8 +2285,8 @@ FRITZBOX_Exec_Remote($$) } # Executed the command on the FritzBox Shell -sub ############################################ -FRITZBOX_Exec_Local($$) +############################################ +sub FRITZBOX_Exec_Local($$) { my ($hash, $cmd) = @_; @@ -2307,6 +2308,11 @@ FRITZBOX_Exec_Local($$) my $cmdStr = join "\necho ' |#|'\n", @{$cmd}; $cmdStr .= "\necho ' |#|'"; my $result = qx($cmdStr); + unless (defined $result) + { + FRITZBOX_Log $hash, 1, "Error: No STDOUT from shell command."; + return undef; + } $result =~ s/\n|\r//g; my @resultArray = split /\|#\|/, $result; foreach (keys @resultArray)