From 48d961082ce88ec2705cf9f6e220461bbb6bdf82 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Sat, 5 Jul 2014 11:11:36 -0500 Subject: [PATCH] Determine full path to arp --- web/skins/classic/views/monitorprobe.php | 10 +++++++++- web/skins/flat/views/monitorprobe.php | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/web/skins/classic/views/monitorprobe.php b/web/skins/classic/views/monitorprobe.php index d9b5b278a..2c48bd071 100644 --- a/web/skins/classic/views/monitorprobe.php +++ b/web/skins/classic/views/monitorprobe.php @@ -287,7 +287,15 @@ $macBases = array( ); unset($output); -$command = "arp -a"; +// Calling arp without the full path was reported to fail on some systems +// Use the builtin unix command "type" to tell us where the command is +$command = "type -p arp"; +$result = exec( escapeshellcmd($command), $output, $status ); +if ( $status ) + Fatal( "Unable determine arp path, status is '$status'" ); +// Now that we know where arp is, call it using the full path +$command = $output[0]." -a"; +unset($output); $result = exec( escapeshellcmd($command), $output, $status ); if ( $status ) Fatal( "Unable to probe network cameras, status is '$status'" ); diff --git a/web/skins/flat/views/monitorprobe.php b/web/skins/flat/views/monitorprobe.php index d9b5b278a..2c48bd071 100644 --- a/web/skins/flat/views/monitorprobe.php +++ b/web/skins/flat/views/monitorprobe.php @@ -287,7 +287,15 @@ $macBases = array( ); unset($output); -$command = "arp -a"; +// Calling arp without the full path was reported to fail on some systems +// Use the builtin unix command "type" to tell us where the command is +$command = "type -p arp"; +$result = exec( escapeshellcmd($command), $output, $status ); +if ( $status ) + Fatal( "Unable determine arp path, status is '$status'" ); +// Now that we know where arp is, call it using the full path +$command = $output[0]." -a"; +unset($output); $result = exec( escapeshellcmd($command), $output, $status ); if ( $status ) Fatal( "Unable to probe network cameras, status is '$status'" );