diff options
Diffstat (limited to 'libc/stdlib/abort.c')
-rw-r--r-- | libc/stdlib/abort.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/libc/stdlib/abort.c b/libc/stdlib/abort.c index 3c0c3c0eb..11448bfb9 100644 --- a/libc/stdlib/abort.c +++ b/libc/stdlib/abort.c @@ -27,26 +27,24 @@ Cambridge, MA 02139, USA. */ typedef void (*vfuncp) (); extern vfuncp __cleanup; -extern void _exit __P ((int __status)) __attribute__ ((__noreturn__)); +extern void _exit __P((int __status)) __attribute__ ((__noreturn__)); /* Cause an abnormal program termination with core-dump. */ -void -abort(void) +void abort(void) { - sigset_t sigset; - - if (sigemptyset(&sigset) == 0 && - sigaddset(&sigset, SIGABRT) == 0) { - sigprocmask(SIG_UNBLOCK, &sigset, (sigset_t *) NULL); - } - - if (__cleanup) - __cleanup(); - - while (1) - if (raise(SIGABRT)) - /* If we can't signal ourselves, exit. */ - _exit(127); - /* If we signal ourselves and are still alive, - or can't exit, loop forever. */ + sigset_t sigset; + + if (sigemptyset(&sigset) == 0 && sigaddset(&sigset, SIGABRT) == 0) { + sigprocmask(SIG_UNBLOCK, &sigset, (sigset_t *) NULL); + } + + if (__cleanup) + __cleanup(); + + while (1) + if (raise(SIGABRT)) + /* If we can't signal ourselves, exit. */ + _exit(127); + /* If we signal ourselves and are still alive, + or can't exit, loop forever. */ } |