summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2008-12-08 01:22:49 +0000
committerScott Ullrich <sullrich@pfsense.org>2008-12-08 01:22:49 +0000
commit839de3f1dc59f6533ec30fc9eac1bf898a57cdbc (patch)
treefcaa2fa6dce632682946af9e986f78a264ca8cff
parentcaecf12dde6c78fec3ae929baecfff01d073a9e4 (diff)
downloadpfsense-839de3f1dc59f6533ec30fc9eac1bf898a57cdbc.zip
pfsense-839de3f1dc59f6533ec30fc9eac1bf898a57cdbc.tar.gz
Check to make sure file exists before operating on it.
-rw-r--r--etc/inc/filter.inc12
1 files changed, 9 insertions, 3 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index 5f18374..9255d46 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -168,7 +168,8 @@ function filter_configure_sync() {
}
// Copy rules.debug to rules.debug.old
- exec("cp {$g['tmp_path']}/rules.debug {$g['tmp_path']}/rules.debug.old");
+ if(file_exists("{$g['tmp_path']}/rules.debug"))
+ exec("cp {$g['tmp_path']}/rules.debug {$g['tmp_path']}/rules.debug.old");
$fd = fopen("{$g['tmp_path']}/rules.debug", "w");
$rules = $aliases . " \n";
@@ -224,8 +225,13 @@ function filter_configure_sync() {
fwrite($fd, $rules);
fclose($fd);
- $rules = file_get_contents("{$g['tmp_path']}/rules.debug");
- $oldrules = file_get_contents("{$g['tmp_path']}/rules.debug.old");
+ $rules = "1"; // force to be diff from oldrules
+ $oldrules = "2"; // force to be diff from rules
+
+ if(file_exists("{$g['tmp_path']}/rules.debug"))
+ $rules = file_get_contents("{$g['tmp_path']}/rules.debug");
+ if(file_exists("{$g['tmp_path']}/rules.debug.old"))
+ $oldrules = file_get_contents("{$g['tmp_path']}/rules.debug.old");
/* Check to see if rules changed, if not do not continue */
if($rules == $oldrules)
OpenPOWER on IntegriCloud