aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorbmeeks8 <bmeeks8@bellsouth.net>2014-10-09 14:49:10 -0400
committerbmeeks8 <bmeeks8@bellsouth.net>2014-10-09 14:49:10 -0400
commitdb4778c2478f525ebc24d351472c036187fd4a81 (patch)
treed9ff23d5289c1a4bfbe5d1ba469c969eb627cbfa /config
parentaf0f8bece934296de9cace977c84fc00ce73b7ed (diff)
downloadpfsense-packages-db4778c2478f525ebc24d351472c036187fd4a81.tar.gz
pfsense-packages-db4778c2478f525ebc24d351472c036187fd4a81.tar.bz2
pfsense-packages-db4778c2478f525ebc24d351472c036187fd4a81.zip
Check and only call conf_mount_rw() when needed.
Diffstat (limited to 'config')
-rwxr-xr-xconfig/snort/snort_check_for_rule_updates.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/config/snort/snort_check_for_rule_updates.php b/config/snort/snort_check_for_rule_updates.php
index 17585336..70ec5a18 100755
--- a/config/snort/snort_check_for_rule_updates.php
+++ b/config/snort/snort_check_for_rule_updates.php
@@ -72,6 +72,7 @@ $snortlibdir = SNORTLIBDIR;
$snortlogdir = SNORTLOGDIR;
$snortiprepdir = SNORT_IPREP_PATH;
$snort_rules_upd_log = SNORT_RULES_UPD_LOGFILE;
+$mounted_rw = FALSE;
/* Save the state of $pkg_interface so we can restore it */
$pkg_interface_orig = $pkg_interface;
@@ -108,8 +109,11 @@ $snort_filename = "snortrules-snapshot-{$snortver[0]}.tar.gz";
$snort_filename_md5 = "{$snort_filename}.md5";
$snort_rule_url = VRT_DNLD_URL;
-/* Mount the Snort conf directories R/W so we can modify files there */
-conf_mount_rw();
+/* Mount the Snort conf directories R/W, if not already, so we can modify files there */
+if (!is_subsystem_dirty('mount')) {
+ conf_mount_rw();
+ $mounted_rw = TRUE;
+}
/* Set up Emerging Threats rules filenames and URL */
if ($etpro == "on") {
@@ -810,11 +814,9 @@ if ($pkg_interface <> "console")
log_error(gettext("[Snort] The Rules update has finished."));
error_log(gettext("The Rules update has finished. Time: " . date("Y-m-d H:i:s"). "\n\n"), 3, $snort_rules_upd_log);
-// Remount filesystem read-only unless we are in package post-install.
-// The post-install code will remount read-only when it completes.
-if (!$g['snort_postinstall'])
+/* Remount filesystem read-only if we changed it in this module */
+if ($mounted_rw == TRUE)
conf_mount_ro();
-conf_mount_ro();
/* Restore the state of $pkg_interface */
$pkg_interface = $pkg_interface_orig;