提交 f279ee45 编写于 作者: M Markus Armbruster 提交者: Eduardo Habkost

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
b0ddb8bf.  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: NMarkus Armbruster <armbru@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
上级 0975b8b8
无相关合并请求
......@@ -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 = '-';
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部