summaryrefslogtreecommitdiff
path: root/src/coredump/coredumpctl.c
diff options
context:
space:
mode:
authorFranck Bui <fbui@suse.com>2016-12-17 15:49:17 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-12-17 09:49:17 -0500
commit3e7bc89b8fdd786ab0188f654c38ad8c199a52be (patch)
treee207a9779e8501573d0a3591c6c8e4ce055d5063 /src/coredump/coredumpctl.c
parentebc8968bc0b6fc460099041f5ae1262ca17eeb6e (diff)
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.
Diffstat (limited to 'src/coredump/coredumpctl.c')
-rw-r--r--src/coredump/coredumpctl.c5
1 files changed, 5 insertions, 0 deletions
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);