gdb/
[binutils-gdb.git] / gdb / ser-pipe.c
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)