From 3e7bc89b8fdd786ab0188f654c38ad8c199a52be Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Sat, 17 Dec 2016 15:49:17 +0100 Subject: coredumpctl: let gdb handle the SIGINT signal (#4901) Even if pressing Ctrl-c after spawning gdb with "coredumpctl gdb" is not really useful, we should let gdb handle the signal entirely otherwise the user can be suprised to see a different behavior when gdb is started by coredumpctl vs when it's started directly. Indeed in the former case, gdb exits due to coredumpctl being killed by the signal. So this patch makes coredumpctl ignore SIGINT as long as gdb is running. --- src/coredump/coredumpctl.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/coredump/coredumpctl.c') diff --git a/src/coredump/coredumpctl.c b/src/coredump/coredumpctl.c index 877bbb34fc..646757f9d9 100644 --- a/src/coredump/coredumpctl.c +++ b/src/coredump/coredumpctl.c @@ -821,6 +821,9 @@ static int run_gdb(sd_journal *j) { if (r < 0) return r; + /* Don't interfere with gdb and its handling of SIGINT. */ + (void) ignore_signals(SIGINT, -1); + pid = fork(); if (pid < 0) { r = log_error_errno(errno, "Failed to fork(): %m"); @@ -845,6 +848,8 @@ static int run_gdb(sd_journal *j) { r = st.si_code == CLD_EXITED ? st.si_status : 255; finish: + (void) default_signals(SIGINT, -1); + if (unlink_path) { log_debug("Removed temporary file %s", path); unlink(path); -- cgit v1.2.3-54-g00ecf