]> git.proxmox.com Git - qemu.git/commitdiff
error: Convert qemu_opts_create() to QError
authorMarkus Armbruster <armbru@redhat.com>
Thu, 25 Mar 2010 16:22:32 +0000 (17:22 +0100)
committerAurelien Jarno <aurelien@aurel32.net>
Sun, 18 Apr 2010 21:46:48 +0000 (23:46 +0200)
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>
qemu-option.c

index f83d07c1e7ab36f7a183476ae0776b4fdafdef8f..12ce32240a19342912fafe6425c3ab8df70c007b 100644 (file)
@@ -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;