From patchwork Wed Oct 2 10:15:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 279678 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6A73A2C0098 for ; Wed, 2 Oct 2013 20:16:17 +1000 (EST) Received: from localhost ([::1]:35141 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRJTa-00072Q-JZ for incoming@patchwork.ozlabs.org; Wed, 02 Oct 2013 06:16:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRJT8-0006t5-PN for qemu-devel@nongnu.org; Wed, 02 Oct 2013 06:15:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VRJT2-0003AA-Q0 for qemu-devel@nongnu.org; Wed, 02 Oct 2013 06:15:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63890) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRJT2-0003A5-HU for qemu-devel@nongnu.org; Wed, 02 Oct 2013 06:15:40 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r92AFcw1031307 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 2 Oct 2013 06:15:38 -0400 Received: from nilsson.home.kraxel.org (vpn1-4-143.ams2.redhat.com [10.36.4.143]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r92AFbQM016620; Wed, 2 Oct 2013 06:15:38 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 23A3D805D9; Wed, 2 Oct 2013 12:15:37 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 2 Oct 2013 12:15:25 +0200 Message-Id: <1380708925-6721-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1380708925-6721-1-git-send-email-kraxel@redhat.com> References: <1380708925-6721-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann , Anthony Liguori , Markus Armbruster Subject: [Qemu-devel] [PATCH 1/1] chardev: handle qmp_chardev_add(KIND_MUX) failure X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Cc: Markus Armbruster Signed-off-by: Gerd Hoffmann --- qemu-char.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qemu-char.c b/qemu-char.c index f7f5464..2ca34cd 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -3271,7 +3271,12 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts, backend->kind = CHARDEV_BACKEND_KIND_MUX; backend->mux->chardev = g_strdup(bid); ret = qmp_chardev_add(id, backend, errp); - assert(!error_is_set(errp)); + if (error_is_set(errp)) { + chr = qemu_chr_find(bid); + qemu_chr_delete(chr); + chr = NULL; + goto qapi_out; + } } chr = qemu_chr_find(id);