summaryrefslogtreecommitdiffstats
path: root/etc/inc/config.lib.inc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-03-19 15:55:04 +0000
committerErmal <eri@pfsense.org>2010-03-19 15:55:04 +0000
commit541989d59005d5b9250d4d51f55cbc4da218937a (patch)
treed52270e174b89fcc940b32443e895c1f854b943f /etc/inc/config.lib.inc
parent773c99bc37c742cc94a1894914c5ba4a7b5abdd7 (diff)
downloadpfsense-541989d59005d5b9250d4d51f55cbc4da218937a.zip
pfsense-541989d59005d5b9250d4d51f55cbc4da218937a.tar.gz
Ticket #434. Do not die when parsing config since we know how to recover. Only die during packages.
Diffstat (limited to 'etc/inc/config.lib.inc')
-rw-r--r--etc/inc/config.lib.inc7
1 files changed, 4 insertions, 3 deletions
diff --git a/etc/inc/config.lib.inc b/etc/inc/config.lib.inc
index 61f76ea..56a8ef8 100644
--- a/etc/inc/config.lib.inc
+++ b/etc/inc/config.lib.inc
@@ -465,14 +465,13 @@ function write_config($desc="Unknown", $backup = true) {
backup_config();
if (time() > mktime(0, 0, 0, 9, 1, 2004)) /* make sure the clock settings are plausible */
- $changetime = time();
+ $config['revision']['time'] = time();
/* Log the running script so it's not entirely unlogged what changed */
if ($desc == "Unknown")
$desc = "{$_SERVER['SCRIPT_NAME']} made unknown change";
$config['revision']['description'] = $desc;
- $config['revision']['time'] = $changetime;
$lockkey = lock('config');
@@ -485,7 +484,8 @@ function write_config($desc="Unknown", $backup = true) {
if (!safe_write_file("{$g['cf_conf_path']}/config.xml", $xmlconfig, false)) {
log_error("WARNING: Config contents could not be save. Could not open file!");
unlock($lockkey);
- die("Unable to open {$g['cf_conf_path']}/config.xml for writing in write_config()\n");
+ file_notice("Unable to open {$g['cf_conf_path']}/config.xml for writing in write_config()\n");
+ return -1;
}
if($g['platform'] == "embedded" or $g['platform'] == "nanobsd") {
@@ -495,6 +495,7 @@ function write_config($desc="Unknown", $backup = true) {
}
/* re-read configuration */
+ /* NOTE: We assume that the file can be parsed since we wrote it. */
$config = parse_xml_config("{$g['conf_path']}/config.xml", $g['xml_rootobj']);
/* write config cache */
OpenPOWER on IntegriCloud