Skip to content

Commit

Permalink
Re-throw a signal
Browse files Browse the repository at this point in the history
Previously, mold exists silently when it gets killed by SIGSEGV.
This change makes it verbose; now the parent process would report
an error.
  • Loading branch information
rui314 committed Mar 11, 2024
1 parent c85dd88 commit c4b69a1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion common/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ static void sighandler(int signo, siginfo_t *info, void *ucontext) {
static std::mutex mu;
std::scoped_lock lock{mu};

// Handle disk full error
switch (signo) {
case SIGSEGV:
case SIGBUS:
Expand All @@ -145,7 +146,12 @@ static void sighandler(int signo, siginfo_t *info, void *ucontext) {
}
}

_exit(1);
// Re-throw the signal
signal(SIGSEGV, SIG_DFL);
signal(SIGBUS, SIG_DFL);
signal(SIGABRT, SIG_DFL);

raise(signo);
}

void install_signal_handler() {
Expand Down

0 comments on commit c4b69a1

Please sign in to comment.