diff options
author | Igor Mammedov <imammedo@redhat.com> | 2014-01-16 17:34:37 +0100 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2014-01-28 11:28:08 -0500 |
commit | 90e9cf28e57a3e1d6caa0a28b0a332ff982ccb0b (patch) | |
tree | d830d0ccae85f7890e41782c6183a7342aa00511 | |
parent | 69252c046741a0955ddb90250f416a2199305091 (diff) |
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>
-rw-r--r-- | vl.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -2800,6 +2800,7 @@ static int object_create(QemuOpts *opts, void *opaque) { const char *type = qemu_opt_get(opts, "qom-type"); const char *id = qemu_opts_id(opts); + Error *local_err = NULL; Object *obj; 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"), - id, obj, NULL); + id, obj, &local_err); + object_unref(obj); + if (local_err) { + qerror_report_err(local_err); + error_free(local_err); + return -1; + } return 0; } |