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

[Xen-changelog] [qemu-xen master] machine: Fix replacement of '_' by '-' in machine property names



commit f279ee45832db52fb801e86a929bc53f575cd2f5
Author:     Markus Armbruster <armbru@xxxxxxxxxx>
AuthorDate: Thu Oct 13 18:44:14 2016 +0200
Commit:     Eduardo Habkost <ehabkost@xxxxxxxxxx>
CommitDate: Mon Oct 17 15:48:40 2016 -0200

    machine: Fix replacement of '_' by '-' in machine property names
    
    machine_set_property() replaces '_' by '-' in the property name.
    Except it fails to replace an initial '_'.  Screwed up in commit
    b0ddb8b.  Reproducer: "-M pc,__foo_bar=true" produces "Property
    '._-foo-bar' not found".
    
    Error messages using a mangled name rather than the name the user
    actually wrote is user-hostile, but that's a different topic.
    
    Signed-off-by: Markus Armbruster <armbru@xxxxxxxxxx>
    Reviewed-by: Eric Blake <eblake@xxxxxxxxxx>
    Reviewed-by: Eduardo Habkost <ehabkost@xxxxxxxxxx>
    Signed-off-by: Eduardo Habkost <ehabkost@xxxxxxxxxx>
---
 vl.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/vl.c b/vl.c
index c657acd..1c0b0ba 100644
--- a/vl.c
+++ b/vl.c
@@ -2804,17 +2804,16 @@ static int machine_set_property(void *opaque,
 {
     Object *obj = OBJECT(opaque);
     Error *local_err = NULL;
-    char *c, *qom_name;
+    char *p, *qom_name;
 
     if (strcmp(name, "type") == 0) {
         return 0;
     }
 
     qom_name = g_strdup(name);
-    c = qom_name;
-    while (*c++) {
-        if (*c == '_') {
-            *c = '-';
+    for (p = qom_name; *p; p++) {
+        if (*p == '_') {
+            *p = '-';
         }
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.