[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v1 2/4] vl.c: -object: don't ingnore duplicate 'id'
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH v1 2/4] vl.c: -object: don't ingnore duplicate 'id' |
Date: |
Thu, 16 Jan 2014 17:34:37 +0100 |
object_property_add_child() may fail if 'id' matches
an already existing object. Which meansi an incorrect
command line.
So instead of silently ignoring error, report it and
terminate QEMU.
Signed-off-by: Igor Mammedov <address@hidden>
---
vl.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/vl.c b/vl.c
index 7f4fe0d..cf3de56 100644
--- a/vl.c
+++ b/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 *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;
}
--
1.7.1
- [Qemu-devel] [PATCH v1 0/4] -object/object-add add 2nd stage initialization, Igor Mammedov, 2014/01/16
- [Qemu-devel] [PATCH v1 1/4] object_add: consolidate error handling, Igor Mammedov, 2014/01/16
- [Qemu-devel] [PATCH v1 3/4] add optional 2nd stage initialization to -object/object-add commands, Igor Mammedov, 2014/01/16
- [Qemu-devel] [PATCH v1 2/4] vl.c: -object: don't ingnore duplicate 'id',
Igor Mammedov <=
- [Qemu-devel] [PATCH v1 4/4] virtio_rng: replace custom backend API with UserCreatable.complete() callback, Igor Mammedov, 2014/01/16
- Re: [Qemu-devel] [PATCH v1 0/4] -object/object-add add 2nd stage initialization, Stefan Hajnoczi, 2014/01/17
- Re: [Qemu-devel] [PATCH v1 0/4] -object/object-add add 2nd stage initialization, Luiz Capitulino, 2014/01/22