diff --git a/lib/libc/stdlib/abort.c b/lib/libc/stdlib/abort.c index f41500739fec..4fd34dcb75c0 100644 --- a/lib/libc/stdlib/abort.c +++ b/lib/libc/stdlib/abort.c @@ -44,11 +44,19 @@ static char sccsid[] = "@(#)abort.c 8.1 (Berkeley) 6/4/93"; #include "pthread_private.h" #endif +void (*__cleanup)(); + void abort() { sigset_t mask; + /* + * POSIX requires we flush stdio buffers on abort + */ + if (__cleanup) + (*__cleanup)(); + sigfillset(&mask); /* * don't block SIGABRT to give any handler a chance; we ignore