b28c64
From 9b379db2f11257f5ef88979fdf9660eaa0ad6b4b Mon Sep 17 00:00:00 2001
b28c64
From: Fam Zheng <famz@redhat.com>
b28c64
Date: Tue, 6 Jun 2017 06:16:56 +0200
b28c64
Subject: [PATCH] spice: fix spice_chr_add_watch() pre-condition
b28c64
MIME-Version: 1.0
b28c64
Content-Type: text/plain; charset=UTF-8
b28c64
Content-Transfer-Encoding: 8bit
b28c64
b28c64
RH-Author: Fam Zheng <famz@redhat.com>
b28c64
Message-id: <20170606061656.29212-2-famz@redhat.com>
b28c64
Patchwork-id: 75488
b28c64
O-Subject: [RHEL-7.3.z qemu-kvm PATCH 1/1] spice: fix spice_chr_add_watch() pre-condition
b28c64
Bugzilla: 1452332
b28c64
RH-Acked-by: John Snow <jsnow@redhat.com>
b28c64
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
b28c64
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
b28c64
b28c64
From: Marc-André Lureau <marcandre.lureau@gmail.com>
b28c64
b28c64
Since e02bc6de30c44fd668dc0d6e1cd1804f2eed3ed3, add_watch() is called
b28c64
with G_IO_HUP. Even if spice-qemu-char ignores this flag, the
b28c64
precondition must be changed.
b28c64
b28c64
https://bugzilla.redhat.com/show_bug.cgi?id=1128992
b28c64
b28c64
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
b28c64
(cherry picked from commit f7a8beb5e6a13dc924895244777d9ef08b23b367)
b28c64
Signed-off-by: Fam Zheng <famz@redhat.com>
b28c64
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
b28c64
---
b28c64
 spice-qemu-char.c | 2 +-
b28c64
 1 file changed, 1 insertion(+), 1 deletion(-)
b28c64
b28c64
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
b28c64
index 6d147a7..079c214 100644
b28c64
--- a/spice-qemu-char.c
b28c64
+++ b/spice-qemu-char.c
b28c64
@@ -171,7 +171,7 @@ static GSource *spice_chr_add_watch(CharDriverState *chr, GIOCondition cond)
b28c64
     SpiceCharDriver *scd = chr->opaque;
b28c64
     SpiceCharSource *src;
b28c64
 
b28c64
-    assert(cond == G_IO_OUT);
b28c64
+    assert(cond & G_IO_OUT);
b28c64
 
b28c64
     src = (SpiceCharSource *)g_source_new(&SpiceCharSourceFuncs,
b28c64
                                           sizeof(SpiceCharSource));
b28c64
-- 
b28c64
1.8.3.1
b28c64