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.
This commit is contained in:
Franck Bui 2016-12-17 15:49:17 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent ebc8968bc0
commit 3e7bc89b8f

View file

@ -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);