Commit 58374214 authored by Jonas Termansen's avatar Jonas Termansen

Don't unblock SIGABRT in abort(3) before calling raise(SIGABRT).

The language in POSIX mentioning overriding blocking or ignoring SIGABRT
refers to the inevitability of exiting by SIGABRT if SIGABRT isn't caught or
if the handler does return.

This implementation of abort(3) implements the standard by raising SIGABRT,
allowing the signal to be caught; and if the signal is blocked or ignored or
the handler returns, then exit_thread(2) forcefully exits the process as if
by SIGABRT.
parent 91816045
/*
* Copyright (c) 2011, 2012, 2013, 2014 Jonas 'Sortie' Termansen.
* Copyright (c) 2011, 2012, 2013, 2014, 2018 Jonas 'Sortie' Termansen.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
......@@ -17,7 +17,6 @@
* Abnormal process termination.
*/
#include <sys/stat.h>
#include <sys/wait.h>
#include <signal.h>
......@@ -33,11 +32,6 @@ void abort(void)
#ifdef __is_sortix_libk
libk_abort();
#else
sigset_t set_of_sigabrt;
sigemptyset(&set_of_sigabrt);
sigaddset(&set_of_sigabrt, SIGABRT);
sigprocmask(SIG_UNBLOCK, &set_of_sigabrt, NULL);
raise(SIGABRT);
int exit_code = WCONSTRUCT(WNATURE_SIGNALED, 128 + SIGABRT, SIGABRT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment