summaryrefslogtreecommitdiffstats
path: root/etc/inc/xmlparse.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/xmlparse.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/xmlparse.inc')
-rw-r--r--etc/inc/xmlparse.inc9
1 files changed, 6 insertions, 3 deletions
diff --git a/etc/inc/xmlparse.inc b/etc/inc/xmlparse.inc
index 85f18e7..459ee15 100644
--- a/etc/inc/xmlparse.inc
+++ b/etc/inc/xmlparse.inc
@@ -173,7 +173,8 @@ function parse_xml_config_pkg($cffile, $rootobj, $isstring = "false") {
$listtags[] = $tag;
}
}
- return parse_xml_config_raw($cffile, $rootobj, $isstring);
+ if (parse_xml_config_raw($cffile, $rootobj, $isstring) == -1)
+ die("XML error: not $rootboj object found!\n");
}
function parse_xml_regdomain(&$rdattributes, $rdfile = '/etc/regdomain.xml', $rootobj = 'regulatory-data') {
@@ -208,7 +209,8 @@ function parse_xml_config_raw($cffile, $rootobj, $isstring = "false") {
xml_parser_set_option($xml_parser,XML_OPTION_SKIP_WHITE, 1);
if (!($fp = fopen($cffile, "r"))) {
- die("Error: could not open XML input\n");
+ log_error("Error: could not open XML input\n");
+ return -1;
}
while ($data = fread($fp, 4096)) {
@@ -222,7 +224,8 @@ function parse_xml_config_raw($cffile, $rootobj, $isstring = "false") {
xml_parser_free($xml_parser);
if (!$parsedcfg[$rootobj]) {
- die("XML error: no $rootobj object found!\n");
+ log_error("XML error: no $rootobj object found!\n");
+ return -1;
}
return $parsedcfg[$rootobj];
OpenPOWER on IntegriCloud