diff options
Diffstat (limited to 'src/coredump/coredumpctl.c')
-rw-r--r-- | src/coredump/coredumpctl.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/coredump/coredumpctl.c b/src/coredump/coredumpctl.c index 2fd5adcddc..5013758909 100644 --- a/src/coredump/coredumpctl.c +++ b/src/coredump/coredumpctl.c @@ -928,17 +928,13 @@ static int run_gdb(sd_journal *j) { /* 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 = safe_fork("(gdb)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_CLOSE_ALL_FDS, &pid); + if (r < 0) { + log_error_errno(r, "Failed to fork(): %m"); goto finish; } - if (pid == 0) { - (void) reset_all_signal_handlers(); - (void) reset_signal_mask(); - + if (r == 0) { execlp("gdb", "gdb", exe, path, NULL); - log_error_errno(errno, "Failed to invoke gdb: %m"); _exit(1); } |