2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

PRESENCE: rerouting STDERR to STDOUT for ping; use char class instead of case-in-sensitive regexp (Forum #27558)

git-svn-id: https://svn.fhem.de/fhem/trunk@6706 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch 2014-10-07 21:24:25 +00:00
parent f96f8cdef4
commit 2d2671c499

View File

@ -582,17 +582,16 @@ PRESENCE_DoLocalPingScan($)
{
$return = "$name|$local|error|Could not execute ping command: \"ping -n $count -4 $device\"";
}
}
else
{
$temp = qx(ping -c $count $device);
$temp = qx(ping -c $count $device 2>&1);
chomp $temp;
if($temp ne "")
{
Log3 $name, 5, "PRESENCE ($name) - ping command returned with output:\n$temp";
$return = "$name|$local|".(($temp =~ /\d+ [Bb]ytes (from|von)/ and not $temp =~ /unreachable/i) ? "present" : "absent");
$return = "$name|$local|".(($temp =~ /\d+ [Bb]ytes (from|von)/ and not $temp =~ /[Uu]nreachable/) ? "present" : "absent");
}
else
{
@ -601,7 +600,6 @@ PRESENCE_DoLocalPingScan($)
}
return $return;
}
sub