From dc8b4c4ec62837814c3ae07eda7813cdc76ef369 Mon Sep 17 00:00:00 2001 From: Ermal Date: Wed, 4 Sep 2013 08:18:51 +0000 Subject: [PATCH] Make the operation of saving old rule nearby the writing operation to be logical to spot --- etc/inc/filter.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 4419d93d0f..8139a00592 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -239,10 +239,6 @@ function filter_configure_sync($delete_states_if_needed = true) { return; } - // Copy rules.debug to rules.debug.old - if(file_exists("{$g['tmp_path']}/rules.debug")) - @copy("{$g['tmp_path']}/rules.debug", "{$g['tmp_path']}/rules.debug.old"); - $limitrules = ""; /* Define the maximum number of tables the system can handle (should be at least aliases*2+some spare) */ $maxtables = is_numeric($config['system']['maximumtables']) ? $config['system']['maximumtables'] : "3000"; @@ -299,6 +295,10 @@ function filter_configure_sync($delete_states_if_needed = true) { unset($aliases, $gateways, $altq_queues, $natrules, $pfrules); + // Copy rules.debug to rules.debug.old + if(file_exists("{$g['tmp_path']}/rules.debug")) + @copy("{$g['tmp_path']}/rules.debug", "{$g['tmp_path']}/rules.debug.old"); + if (!@file_put_contents("{$g['tmp_path']}/rules.debug", $rules, LOCK_EX)) { log_error("WARNING: Could not write new rules!"); unlock($filterlck);