[Libosinfo] [PATCH] osinfo-install-script: read config values as strings

Giuseppe Scrivano gscrivan at redhat.com
Mon Mar 17 14:20:44 UTC 2014


Prefer xmlNewDocRawNode to xmlNewDocNode when the content is a raw
string.

Solves this problem:

$ osinfo-install-script rhel6.5 -c "admin-password=a&b"
error : unterminated entity reference               b

Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
---
 osinfo/osinfo_install_script.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
index 1a0b579..b6fe1ab 100644
--- a/osinfo/osinfo_install_script.c
+++ b/osinfo/osinfo_install_script.c
@@ -670,8 +670,8 @@ static xmlNodePtr osinfo_install_script_generate_entity_xml(OsinfoInstallScript
         goto error;
     }
 
-    if (!(data = xmlNewDocNode(NULL, NULL, (const xmlChar*)"id",
-                               (const xmlChar*)osinfo_entity_get_id(entity)))) {
+    if (!(data = xmlNewDocRawNode(NULL, NULL, (const xmlChar*)"id",
+                                  (const xmlChar*)osinfo_entity_get_id(entity)))) {
         xmlErrorPtr err = xmlGetLastError();
         g_set_error(error, 0, 0, _("Unable to create XML node 'id': '%s'"),
                     err ? err->message : "");
@@ -698,8 +698,8 @@ static xmlNodePtr osinfo_install_script_generate_entity_xml(OsinfoInstallScript
 
         tmp2 = values;
         while (tmp2) {
-            if (!(data = xmlNewDocNode(NULL, NULL, (const xmlChar*)tmp1->data,
-                                       (const xmlChar*)tmp2->data))) {
+            if (!(data = xmlNewDocRawNode(NULL, NULL, (const xmlChar*)tmp1->data,
+                                          (const xmlChar*)tmp2->data))) {
                 xmlErrorPtr err = xmlGetLastError();
                 g_set_error(error, 0, 0, _("Unable to create XML node '%s': '%s'"),
                             (const gchar *)tmp1->data, err ? err->message : "");
-- 
1.8.5.3




More information about the Libosinfo mailing list