Fixes device_add to report duplicate ID properly in QMP, as
DuplicateId instead of UndefinedError.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
#include "qemu-error.h"
#include "qemu-objects.h"
#include "qemu-option.h"
+#include "qerror.h"
/*
* Extracts the name of an option from the parameter string (p points at the
opts = qemu_opts_find(list, id);
if (opts != NULL) {
if (fail_if_exists) {
- fprintf(stderr, "tried to create id \"%s\" twice for \"%s\"\n",
- id, list->name);
+ qerror_report(QERR_DUPLICATE_ID, id, list->name);
return NULL;
} else {
return opts;