Improve handling of XML errors for fix permissions

This commit is contained in:
Dees_Troy
2013-04-05 12:02:14 -05:00
parent 91862e618e
commit 34614eb94f
3 changed files with 36 additions and 13 deletions
+7 -3
View File
@@ -443,15 +443,19 @@ int fixPermissions::getPackages() {
xmlFile.read(&xmlBuf[0], len);
xmlBuf[len] = '\0';
xml_document<> pkgDoc;
LOGINFO("parsing package, %i...\n", len);
pkgDoc.parse<parse_full>(&xmlBuf[0]);
xml_node<> * pkgNode = pkgDoc.first_node("packages");
xml_node <> * next = pkgNode->first_node("package");
if (next == NULL) {
if (pkgNode == NULL) {
LOGERR("No packages found to fix.\n");
return -1;
}
xml_node <> * next = pkgNode->first_node("package");
if (next == NULL) {
LOGERR("No package found to fix.\n");
return -1;
}
//Get packages
while (next->first_attribute("name") != NULL) {