diff options
author | Seth Mos <seth.mos@xs4all.nl> | 2008-11-02 00:42:00 +0000 |
---|---|---|
committer | Seth Mos <seth.mos@xs4all.nl> | 2008-11-02 00:42:00 +0000 |
commit | f9db3cda791ab8435bd9e7ae4bd509ce6efbbc01 (patch) | |
tree | 42b668cf4390470cef1ff53efcf910df4f61efa6 /etc/inc/util.inc | |
parent | bedd9fc0f0b25232aba34577830096050aaad9d8 (diff) | |
download | pfsense-f9db3cda791ab8435bd9e7ae4bd509ce6efbbc01.zip pfsense-f9db3cda791ab8435bd9e7ae4bd509ce6efbbc01.tar.gz |
Correct var types.
Add debugging for command execution and log errors when command does not return 0 (succes)
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r-- | etc/inc/util.inc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 9810ede..93d9aac 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -1,6 +1,4 @@ -<?php -/* $Id$ */ -/* +<?php /* $Id$ */ /* util.inc part of m0n0wall (http://m0n0.ch/wall) @@ -413,16 +411,19 @@ function get_interface_list($mode = "active", $keyby = "physical", $vfaces = "") function mwexec($command) { global $g; - $oarr = ""; - $retval = ""; + $oarr = array(); + $retval = 0; if ($g['debug']) { if (!$_SERVER['REMOTE_ADDR']) echo "mwexec(): $command\n"; - exec("$command > /dev/null 2>&1", $oarr, $retval); + exec("$command 2>&1", $oarr, $retval); } else { - exec("$command > /dev/null 2>&1", $oarr, $retval); + exec("$command 2>&1", $oarr, $retval); + } + if($retval > 0) { + $output = implode(" ", $oarr); + log_error("The command '$command' returned exit code '$retval', the output was '$output' "); } - return $retval; } @@ -674,4 +675,4 @@ function format_bytes($bytes) { } } -?>
\ No newline at end of file +?> |