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.
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");
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);