From patchwork Mon Mar 22 09:48:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 48279 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 4FABAB7D03 for ; Mon, 22 Mar 2010 21:23:43 +1100 (EST) Received: from localhost ([127.0.0.1]:39805 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtelY-00039D-FX for incoming@patchwork.ozlabs.org; Mon, 22 Mar 2010 06:21:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NteFx-0006fG-8Q for qemu-devel@nongnu.org; Mon, 22 Mar 2010 05:49:09 -0400 Received: from [199.232.76.173] (port=57961 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NteFv-0006dd-A5 for qemu-devel@nongnu.org; Mon, 22 Mar 2010 05:49:07 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NteFl-0007RT-Om for qemu-devel@nongnu.org; Mon, 22 Mar 2010 05:49:06 -0400 Received: from oxygen.pond.sub.org ([213.239.205.148]:54249) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NteFl-0007R2-0H for qemu-devel@nongnu.org; Mon, 22 Mar 2010 05:48:57 -0400 Received: from blackfin.pond.sub.org (pD951ABC6.dip.t-dialin.net [217.81.171.198]) by oxygen.pond.sub.org (Postfix) with ESMTPA id 40EC5276DA7 for ; Mon, 22 Mar 2010 10:48:54 +0100 (CET) Received: by blackfin.pond.sub.org (Postfix, from userid 500) id AA976DB; Mon, 22 Mar 2010 10:48:53 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 22 Mar 2010 10:48:45 +0100 Message-Id: <1269251333-20821-4-git-send-email-armbru@redhat.com> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1269251333-20821-1-git-send-email-armbru@redhat.com> References: <1269251333-20821-1-git-send-email-armbru@redhat.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: lcapitulino@redhat.com Subject: [Qemu-devel] [PATCH v2 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;