diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2007-04-24 18:15:36 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2007-04-24 18:15:36 +0000 |
commit | c4dfa47bb41176cc1b97ab509461fb0ee7b541a2 (patch) | |
tree | c472f303431ed41338b1a9b51fe523378a8c20ce /etc/inc | |
parent | aac9905d6067d019609e417549c65393cf425e96 (diff) | |
download | pfsense-c4dfa47bb41176cc1b97ab509461fb0ee7b541a2.zip pfsense-c4dfa47bb41176cc1b97ab509461fb0ee7b541a2.tar.gz |
Detect 0 byte config.xml cases and attempt to restore a previous backup.
With this change my wrap that has been panicing for 30 hours straight boots right back off and we will continue the panic torture test.
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/config.inc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc index 30e4f8c..433abeb 100644 --- a/etc/inc/config.inc +++ b/etc/inc/config.inc @@ -206,6 +206,15 @@ EOD; ******/ function parse_config($parse = false) { global $g; + if(filesize("{$g['conf_path']}/config.xml") == 0) { + $last_backup = discover_last_backup(); + if($last_backup) { + log_error("No config.xml found, attempting last known config restore."); + restore_backup("{$g['conf_path']}/backup/{$last_backup}"); + } else { + die("Config.xml is corrupted and is 0 bytes. Could not restore a previous backup."); + } + } if($g['booting']) echo "."; config_lock(); if(!$parse) { |