From e34838f0f74e1fdb249bcdd822136c98375e4f4b Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Tue, 25 May 2010 16:00:09 +0000 Subject: [PATCH] * ser-pipe.c (pipe_open): Ignore SIGINTs in child. --- gdb/ChangeLog | 2 ++ gdb/ser-pipe.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8dac10a7e1a..8690bc60735 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,7 @@ 2010-05-25 Doug Evans + * 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 diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c index 92ad3d91fd3..07fe65b14e9 100644 --- a/gdb/ser-pipe.c +++ b/gdb/ser-pipe.c @@ -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) -- 2.30.2