From f7b3d6887935fe4b2582fac68f60aa3a8e43007b Mon Sep 17 00:00:00 2001
From: Gleb Natapov <gleb@redhat.com>
Date: Mon, 5 Sep 2011 10:02:44 +0200
Subject: [PATCH 06/13] register signal handler after initializing SDL

RH-Author: Gleb Natapov <gleb@redhat.com>
Message-id: <1315216966-10369-2-git-send-email-gleb@redhat.com>
Patchwork-id: 32338
O-Subject: [PATCH RHEL6.3 1/3] register signal handler after initializing SDL
Bugzilla: 735716
RH-Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>

SDL library initialization mangles signal handlers, so QEMU should
register them after initializing SDL. This was the case before and code
even have a comment about that. Fix it to be so again.

Upstream commit: 0ce235a7ee5a1852c0a18d4764ac0a6700805c83
---
 vl.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 vl.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/vl.c b/vl.c
index dc01255..da2e7f8 100644
--- a/vl.c
+++ b/vl.c
@@ -6090,11 +6090,6 @@ int main(int argc, char **argv, char **envp)
                   kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
 
 
-#ifndef _WIN32
-    /* must be after terminal init, SDL library changes signal handlers */
-    sighandler_setup();
-#endif
-
     for (env = first_cpu; env != NULL; env = env->next_cpu) {
         for (i = 0; i < nb_numa_nodes; i++) {
             if (node_cpumask[i] & (1 << env->cpu_index)) {
@@ -6156,6 +6151,11 @@ int main(int argc, char **argv, char **envp)
         break;
     }
 
+#ifndef _WIN32
+    /* must be after terminal init, SDL library changes signal handlers */
+    sighandler_setup();
+#endif
+
     /* init remote displays */
     if (vnc_display) {
         vnc_display_init(ds);
-- 
1.7.4.4

