summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2015-07-10 18:12:09 -0500
committerChris Buechler <cmb@pfsense.org>2015-07-10 18:13:49 -0500
commit8a811010a4723f9394b2139a45d4b3ef958cfdc0 (patch)
tree3d31480613f34d1d7574c2281bd6829409fd1244 /etc
parentd7b97ca34c560106bd98e63ba99fa90f1388ae09 (diff)
downloadpfsense-8a811010a4723f9394b2139a45d4b3ef958cfdc0.zip
pfsense-8a811010a4723f9394b2139a45d4b3ef958cfdc0.tar.gz
fsync after fclose here, clean up some white space while here.
Conflicts: etc/inc/config.lib.inc
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/config.lib.inc11
1 files changed, 9 insertions, 2 deletions
diff --git a/etc/inc/config.lib.inc b/etc/inc/config.lib.inc
index dc2f369..df96461 100644
--- a/etc/inc/config.lib.inc
+++ b/etc/inc/config.lib.inc
@@ -81,6 +81,7 @@ function encrypted_configxml() {
exec("/bin/mv {$g['conf_path']}/config.xml.tmp {$g['conf_path']}/config.xml");
echo "\n" . gettext("Config.xml unlocked.") . "\n";
fclose($fp);
+ pfSense_fsync("{$g['conf_path']}/config.xml");
} else {
echo "\n" . gettext("Invalid password entered. Please try again.") . "\n";
}
@@ -187,12 +188,15 @@ function generate_config_cache($config) {
$configcache = fopen($g['tmp_path'] . '/config.cache', "w");
fwrite($configcache, serialize($config));
fclose($configcache);
+ pfSense_fsync($configcache);
+
unset($configcache);
/* Used for config.extra.xml */
if (file_exists($g['tmp_path'] . '/config.extra.cache') && $config_extra) {
$configcacheextra = fopen($g['tmp_path'] . '/config.extra.cache', "w");
fwrite($configcacheextra, serialize($config_extra));
fclose($configcacheextra);
+ pfSense_fsync($configcacheextra);
unset($configcacheextra);
}
}
@@ -495,7 +499,7 @@ function safe_write_file($file, $content, $force_binary) {
}
// Sync file before returning
- return pfSense_fsync(dirname($file));
+ return pfSense_fsync($file);
}
/****f* config/write_config
@@ -830,6 +834,7 @@ function cleanup_backupcache($lock = false) {
$bakout = fopen($g['cf_conf_path'] . '/backup/backup.cache', "w");
fwrite($bakout, serialize($tocache));
fclose($bakout);
+ pfSense_fsync("{$g['cf_conf_path']}/backup/backup.cache");
conf_mount_ro();
if (!$lock) {
@@ -866,12 +871,12 @@ function backup_config() {
/* Create backup directory if needed */
safe_mkdir("{$g['cf_conf_path']}/backup");
-
if ($config['revision']['time'] == "") {
$baktime = 0;
} else {
$baktime = $config['revision']['time'];
}
+
if ($config['revision']['description'] == "") {
$bakdesc = "Unknown";
} else {
@@ -881,6 +886,7 @@ function backup_config() {
$bakver = ($config['version'] == "") ? "?" : $config['version'];
$bakfilename = $g['cf_conf_path'] . '/backup/config-' . $baktime . '.xml';
copy($g['cf_conf_path'] . '/config.xml', $bakfilename);
+
if (file_exists($g['cf_conf_path'] . '/backup/backup.cache')) {
$backupcache = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache'));
} else {
@@ -890,6 +896,7 @@ function backup_config() {
$bakout = fopen($g['cf_conf_path'] . '/backup/backup.cache', "w");
fwrite($bakout, serialize($backupcache));
fclose($bakout);
+ pfSense_fsync("{$g['cf_conf_path']}/backup/backup.cache");
conf_mount_ro();
OpenPOWER on IntegriCloud