[PATCH] Improve error message diagnosing incorrect XML CPU mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

Tell the user what CPU mode value is wrong
---
 src/conf/cpu_conf.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 018d571..b520f7c 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -234,13 +234,15 @@ virCPUDefParseXML(const xmlNodePtr node,
             goto error;
         } else {
             def->mode = virCPUModeTypeFromString(cpuMode);
-            VIR_FREE(cpuMode);
 
             if (def->mode < 0) {
-                virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                                  _("Invalid mode attribute"));
+                virCPUReportError(VIR_ERR_INTERNAL_ERROR,
+                                  _("Invalid mode attribute '%s'"),
+                                  cpuMode);
+                VIR_FREE(cpuMode);
                 goto error;
             }
+            VIR_FREE(cpuMode);
         }
     } else {
         if (def->type == VIR_CPU_TYPE_HOST)
-- 
1.7.10.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]