From 583742147836f0cd963d2bd3f152f8a4e245d7f5 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Sat, 1 Sep 2018 12:42:13 +0200 Subject: [PATCH] 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. --- libc/stdlib/abort.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/libc/stdlib/abort.c b/libc/stdlib/abort.c index 93d574b0..112f6c0e 100644 --- a/libc/stdlib/abort.c +++ b/libc/stdlib/abort.c @@ -1,5 +1,5 @@ /* - * 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 #include #include @@ -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);