2008-08-22 Miguel de Icaza <miguel@novell.com>
authorMiguel de Icaza <miguel@gnome.org>
Sat, 23 Aug 2008 00:42:18 +0000 (00:42 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Sat, 23 Aug 2008 00:42:18 +0000 (00:42 -0000)
* console-io.c (sigcont_handler): Support signal chaining for
SIGCONT.

(console_set_signal_handlers): Use best practices with sigaction,
clear the structure before using it.

svn path=/trunk/mono/; revision=111454

mono/metadata/ChangeLog
mono/metadata/console-io.c

index 39d6e078cc463bc62d9084fc71b6bbc2e6fce81b..41e0de0d8b0d6aeb209f227033c38f811eb876b0 100644 (file)
@@ -1,3 +1,11 @@
+2008-08-22  Miguel de Icaza  <miguel@novell.com>
+
+       * console-io.c (sigcont_handler): Support signal chaining for
+       SIGCONT.
+
+       (console_set_signal_handlers): Use best practices with sigaction,
+       clear the structure before using it. 
+
 2008-08-22  Robert Jordan  <robertj@gmx.net>
 
        * console-io.c (ves_icall_System_ConsoleDriver_TtySetup):
index 08b435ac7131044f67cb06f296152fb9c8d26273..5b27b95badad84f7cac27eef678a1ed8958de2bf 100644 (file)
@@ -262,25 +262,33 @@ sigint_handler (int signo)
        in_sigint = FALSE;
 }
 
+static struct sigaction save_sigcont, save_sigint;
+
 static void
-sigcont_handler (int signo)
+sigcont_handler (int signo, void *the_siginfo, void *data)
 {
        // Ignore error, there is not much we can do in the sigcont handler.
        tcsetattr (STDIN_FILENO, TCSANOW, &mono_attr);
 
        if (keypad_xmit_str != NULL)
                write (STDOUT_FILENO, keypad_xmit_str, strlen (keypad_xmit_str));
-}
 
-static struct sigaction save_sigcont, save_sigint;
+       if (save_sigcont.sa_sigaction != NULL &&
+           save_sigcont.sa_sigaction != (void *)SIG_DFL &&
+           save_sigcont.sa_sigaction != (void *)SIG_IGN)
+               (*save_sigcont.sa_sigaction) (signo, the_siginfo, data);
+}
 
 void
 console_set_signal_handlers ()
 {
        struct sigaction sigcont, sigint;
 
+       memset (&sigcont, 0, sizeof (struct sigaction));
+       memset (&sigint, 0, sizeof (struct sigaction));
+       
        // Continuing
-       sigcont.sa_handler = sigcont_handler;
+       sigcont.sa_handler = (void *) sigcont_handler;
        sigcont.sa_flags = 0;
        sigemptyset (&sigcont.sa_mask);
        sigaction (SIGCONT, &sigcont, &save_sigcont);