summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/exit/abort.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/exit/abort.c b/src/exit/abort.c
index ecc0f735..5e5a87c3 100644
--- a/src/exit/abort.c
+++ b/src/exit/abort.c
@@ -1,13 +1,31 @@
#include <stdlib.h>
#include <signal.h>
+#include <string.h>
#include "syscall.h"
#include "pthread_impl.h"
#include "atomic.h"
_Noreturn void abort(void)
{
+ struct sigaction abrtaction;
+ sigset_t abrtset;
+
raise(SIGABRT);
__block_all_sigs(0);
+
+ /* Unblock just SIGABRT, and set default handler */
+ sigemptyset(&abrtset);
+ sigaddset(&abrtset, SIGABRT);
+ sigprocmask(SIG_UNBLOCK, &abrtset, 0);
+
+ memset(&abrtaction, 0, sizeof(struct sigaction));
+ abrtaction.sa_handler = SIG_DFL;
+
+ sigaction(SIGABRT, &abrtaction, NULL);
+
+ raise(SIGABRT);
+
+ /* Ok, give up. */
a_crash();
raise(SIGKILL);
_Exit(127);