thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
218e99
From a498fc16bc9b1bfa983a95ca97dae183d8d4627e Mon Sep 17 00:00:00 2001
218e99
From: Gerd Hoffmann <kraxel@redhat.com>
218e99
Date: Mon, 14 Oct 2013 13:35:23 +0200
218e99
Subject: [PATCH 16/18] chardev: handle qmp_chardev_add(KIND_MUX) failure
218e99
218e99
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
218e99
Message-id: <1381757723-23134-16-git-send-email-kraxel@redhat.com>
218e99
Patchwork-id: 54860
218e99
O-Subject: [RHEL-7 qemu-kvm PATCH 15/15] chardev: handle qmp_chardev_add(KIND_MUX) failure
218e99
Bugzilla: 922010
218e99
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>
218e99
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
218e99
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
218e99
Cc: Markus Armbruster <armbru@redhat.com>
218e99
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
218e99
(cherry picked from commit ee6ee83de29923483b4905b35f18abf5333f6ea9)
218e99
---
218e99
 qemu-char.c | 7 ++++++-
218e99
 1 file changed, 6 insertions(+), 1 deletion(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 qemu-char.c |    7 ++++++-
218e99
 1 files changed, 6 insertions(+), 1 deletions(-)
218e99
218e99
diff --git a/qemu-char.c b/qemu-char.c
218e99
index bacc7b7..983f686 100644
218e99
--- a/qemu-char.c
218e99
+++ b/qemu-char.c
218e99
@@ -3255,7 +3255,12 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
218e99
             backend->kind = CHARDEV_BACKEND_KIND_MUX;
218e99
             backend->mux->chardev = g_strdup(bid);
218e99
             ret = qmp_chardev_add(id, backend, errp);
218e99
-            assert(!error_is_set(errp));
218e99
+            if (error_is_set(errp)) {
218e99
+                chr = qemu_chr_find(bid);
218e99
+                qemu_chr_delete(chr);
218e99
+                chr = NULL;
218e99
+                goto qapi_out;
218e99
+            }
218e99
         }
218e99
 
218e99
         chr = qemu_chr_find(id);
218e99
-- 
218e99
1.7.1
218e99