LibC: Implement spec compliant abort()

This commit is contained in:
Bananymous 2025-04-01 23:06:30 +03:00
parent 36026d4ec6
commit 788f5429e1
1 changed files with 9 additions and 3 deletions

View File

@ -27,9 +27,15 @@ static uint32_t at_exit_funcs_count = 0;
void abort(void) void abort(void)
{ {
fflush(nullptr); sigset_t set;
fprintf(stderr, "abort()\n"); sigemptyset(&set);
exit(1); sigaddset(&set, SIGABRT);
sigprocmask(SIG_UNBLOCK, &set, nullptr);
raise(SIGABRT);
signal(SIGABRT, SIG_DFL);
raise(SIGABRT);
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }