From patchwork Thu Mar 25 16:22:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 48537 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A6646B7CF5 for ; Fri, 26 Mar 2010 03:42:40 +1100 (EST) Received: from localhost ([127.0.0.1]:49213 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nuq8V-00061p-Ae for incoming@patchwork.ozlabs.org; Thu, 25 Mar 2010 12:42:23 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nuppg-0005gf-PA for qemu-devel@nongnu.org; Thu, 25 Mar 2010 12:22:56 -0400 Received: from [140.186.70.92] (port=35950 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NuppY-0005XF-9M for qemu-devel@nongnu.org; Thu, 25 Mar 2010 12:22:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NuppT-0001EG-Tp for qemu-devel@nongnu.org; Thu, 25 Mar 2010 12:22:46 -0400 Received: from oxygen.pond.sub.org ([213.239.205.148]:52300) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NuppT-0001D5-M7 for qemu-devel@nongnu.org; Thu, 25 Mar 2010 12:22:43 -0400 Received: from blackfin.pond.sub.org (pD9E38AC7.dip.t-dialin.net [217.227.138.199]) by oxygen.pond.sub.org (Postfix) with ESMTPA id 692D2276DA2 for ; Thu, 25 Mar 2010 17:22:41 +0100 (CET) Received: by blackfin.pond.sub.org (Postfix, from userid 500) id C2E8FDC; Thu, 25 Mar 2010 17:22:40 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Thu, 25 Mar 2010 17:22:32 +0100 Message-Id: <1269534160-4550-4-git-send-email-armbru@redhat.com> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1269534160-4550-1-git-send-email-armbru@redhat.com> References: <1269534160-4550-1-git-send-email-armbru@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: lcapitulino@redhat.com Subject: [Qemu-devel] [PATCH v3 03/11] error: Convert qemu_opts_create() to QError X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Fixes device_add to report duplicate ID properly in QMP, as DuplicateId instead of UndefinedError. Signed-off-by: Markus Armbruster --- qemu-option.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu-option.c b/qemu-option.c index f83d07c..12ce322 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;