* ser-pipe.c (pipe_open): Ignore SIGINTs in child.
authorDoug Evans <dje@google.com>
Tue, 25 May 2010 16:00:09 +0000 (16:00 +0000)
committerDoug Evans <dje@google.com>
Tue, 25 May 2010 16:00:09 +0000 (16:00 +0000)
gdb/ChangeLog
gdb/ser-pipe.c

index 8dac10a7e1a187b005d3776f84cd1da1b55c4e02..8690bc607359d694b6195d51701ca12845e2f792 100644 (file)
@@ -1,5 +1,7 @@
 2010-05-25  Doug Evans  <dje@google.com>
 
+       * ser-pipe.c (pipe_open): Ignore SIGINTs in child.
+
        * event-loop.h (GDB_READABLE, GDB_WRITABLE, GDB_EXCEPTION): Move to ...
        * event-loop.c: ... here.
        * tui/tui-io.c (tui_readline_output): Rename parameter `code' to
index 92ad3d91fd338ffe1e1b881bef83d7b894af4843..07fe65b14e93c4dd30ce927b975f6ec2d1fbb2b9 100644 (file)
@@ -99,6 +99,15 @@ pipe_open (struct serial *scb, const char *name)
   /* Child. */
   if (pid == 0)
     {
+      /* We don't want ^c to kill the connection.  */
+#ifdef HAVE_SETSID
+      pid_t sid = setsid ();
+      if (sid == -1)
+       signal (SIGINT, SIG_IGN);
+#else
+      signal (SIGINT, SIG_IGN);
+#endif
+
       /* re-wire pdes[1] to stdin/stdout */
       close (pdes[0]);
       if (pdes[1] != STDOUT_FILENO)