mirror of https://github.com/xemu-project/xemu.git
vl.c: -object: don't ignore duplicate 'id'
object_property_add_child() may fail if 'id' matches an already existing object. Which means an incorrect command line. So instead of silently ignoring error, report it and terminate QEMU. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
69252c0467
commit
90e9cf28e5
9
vl.c
9
vl.c
|
@ -2800,6 +2800,7 @@ static int object_create(QemuOpts *opts, void *opaque)
|
||||||
{
|
{
|
||||||
const char *type = qemu_opt_get(opts, "qom-type");
|
const char *type = qemu_opt_get(opts, "qom-type");
|
||||||
const char *id = qemu_opts_id(opts);
|
const char *id = qemu_opts_id(opts);
|
||||||
|
Error *local_err = NULL;
|
||||||
Object *obj;
|
Object *obj;
|
||||||
|
|
||||||
g_assert(type != NULL);
|
g_assert(type != NULL);
|
||||||
|
@ -2816,8 +2817,14 @@ static int object_create(QemuOpts *opts, void *opaque)
|
||||||
}
|
}
|
||||||
|
|
||||||
object_property_add_child(container_get(object_get_root(), "/objects"),
|
object_property_add_child(container_get(object_get_root(), "/objects"),
|
||||||
id, obj, NULL);
|
id, obj, &local_err);
|
||||||
|
|
||||||
object_unref(obj);
|
object_unref(obj);
|
||||||
|
if (local_err) {
|
||||||
|
qerror_report_err(local_err);
|
||||||
|
error_free(local_err);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue