From c4b69a107719caccdd415ed85a554898de9acc6d Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Mon, 11 Mar 2024 16:03:41 +0900 Subject: [PATCH] Re-throw a signal Previously, mold exists silently when it gets killed by SIGSEGV. This change makes it verbose; now the parent process would report an error. --- common/main.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/main.cc b/common/main.cc index 1cabab4ce3..ee8db071ce 100644 --- a/common/main.cc +++ b/common/main.cc @@ -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: @@ -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() {