From 9e1520b2efe1a49715312103e9dc4fa32d4322e4 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Mon, 8 Aug 2011 12:13:28 -0700
Subject: [RHEL6 qemu-kvm PATCH 1/4] spice: catch spice server initialization failures.

RH-Author: Gerd Hoffmann <kraxel@redhat.com>
Message-id: <1312805609-9379-2-git-send-email-kraxel@redhat.com>
Patchwork-id: 31065
O-Subject: [RHEL-6.2 kvm PATCH 1/2] spice: catch spice server initialization failures.
Bugzilla: 682227
RH-Acked-by: Alon Levy <alevy@redhat.com>
RH-Acked-by: Yonit Halperin <yhalperi@redhat.com>
RH-Acked-by: Arnon Gilboa <agilboa@redhat.com>
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>

When the spice server initialization fails report this and exit instead
of ignoring the error.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit fba810f1f67b411c209aa0e3d90724127cbd9c0f)

bugzilla: 682227 - qemu-kvm doesn't exit when binding to specified port fails
---
 ui/spice-core.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 ui/spice-core.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/ui/spice-core.c b/ui/spice-core.c
index 9eade46..2d2729d 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -623,7 +623,10 @@ void qemu_spice_init(void)
 
     qemu_opt_foreach(opts, add_channel, NULL, 0);
 
-    spice_server_init(spice_server, &core_interface);
+    if (0 != spice_server_init(spice_server, &core_interface)) {
+        fprintf(stderr, "failed to initialize spice server");
+        exit(1);
+    };
     using_spice = 1;
 
     migration_state.notify = migration_state_notifier;
-- 
1.7.3.2

