Patchwork [03/11] error: Convert qemu_opts_create() to QError

login
register
mail settings
Submitter Markus Armbruster
Date March 18, 2010, 4:33 p.m.
Message ID <1268929996-28763-4-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/48062/
State New
Headers show

Comments

Markus Armbruster - March 18, 2010, 4:33 p.m.
Fixes device_add to report duplicate ID properly in QMP, as
DuplicateId instead of UndefinedError.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 qemu-option.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/qemu-option.c b/qemu-option.c
index dc340b8..e3916be 100644
--- a/qemu-option.c
+++ b/qemu-option.c
@@ -30,6 +30,7 @@ 
 #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
@@ -643,8 +644,7 @@  QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, int fail_if_exist
         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;