From 48006baf615c052b7939ee43cd262c253087fcf4 Mon Sep 17 00:00:00 2001 From: Ermal Date: Mon, 21 Jan 2013 19:57:15 +0000 Subject: [PATCH] Correct error/alert displaying. Also remove redundant log_errror since file_notice does that by its own --- etc/inc/filter.inc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 72a593664d..4e83a68ecd 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -303,12 +303,13 @@ function filter_configure_sync($delete_states_if_needed = true) { echo "pfctl being called at $mt\n"; } unset($rules_loading, $rules_error); - exec("/sbin/pfctl -o basic -f {$g['tmp_path']}/rules.debug", $rules_error, $rules_loading); + $_grbg = exec("/sbin/pfctl -o basic -f {$g['tmp_path']}/rules.debug 2>&1", $rules_error, $rules_loading); if(isset($config['system']['developerspew'])) { $mt = microtime(); echo "pfctl done at $mt\n"; } - /* check for a error while loading the rules file. if an error has occured + /* + * check for a error while loading the rules file. if an error has occured * then output the contents of the error to the caller */ if($rules_loading <> 0) { @@ -319,18 +320,16 @@ function filter_configure_sync($delete_states_if_needed = true) { $line_error = sprintf(gettext('The line in question reads [%1$d]: %2$s'), $line_number, $line_split[$line_number-1]); unset($line_split); if ($line_error and $line_number) { - file_notice("filter_load", sprintf(gettext('There were error(s) loading the rules: %1$s - %2$s'), $rules_error, $line_error), "Filter Reload", ""); - log_error("There were error(s) loading the rules: {$rules_error} - {$line_error}"); - update_filter_reload_status(sprintf(gettext('There were error(s) loading the rules: %1$s - %2$s'), $rules_error, $line_error)); + file_notice("filter_load", sprintf(gettext('There were error(s) loading the rules: %1$s - %2$s'), $rules_error[0], $line_error), "Filter Reload", ""); + update_filter_reload_status(sprintf(gettext('There were error(s) loading the rules: %1$s - %2$s'), $rules_error[0], $line_error)); unlock($filterlck); return; } /* Brutal ugly hack but required -- PF is stuck, unwedge */ - if (strstr("$rules_error", "busy")) { + if (strstr("$rules_error[0]", "busy")) { exec("/sbin/pfctl -d; /sbin/pfctl -e; /sbin/pfctl -f {$g['tmp_path']}/rules.debug"); $error_msg = gettext("PF was wedged/busy and has been reset."); file_notice("pf_busy", $error_msg, "pf_busy", ""); - log_error($error_msg); } }