.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: abort.3,v 1.10 2013/07/17 05:42:11 schwarze Exp $
+.\" $OpenBSD: abort.3,v 1.11 2014/05/14 21:54:20 tedu Exp $
.\"
-.Dd $Mdocdate: July 17 2013 $
+.Dd $Mdocdate: May 14 2014 $
.Dt ABORT 3
.Os
.Sh NAME
.Dv SIGABRT
is being caught and the signal handler does not return.
.Pp
-Any open streams are flushed and closed.
+Some implementations may flush output streams before terminating.
+This implementation does not.
.Sh RETURN VALUES
The
.Fn abort
.Fn abort
function first appeared in
.At v5 .
+.Pp
+Historically, previous standards required
+.Fn abort
+to flush and close output streams, but this conflicted with the requirement
+that
+.Fn abort
+be async signal safe.
+As a result, the flushing requirement was dropped.
-/* $OpenBSD: abort.c,v 1.16 2012/11/10 03:46:11 guenther Exp $ */
+/* $OpenBSD: abort.c,v 1.17 2014/05/14 21:54:20 tedu Exp $ */
/*
* Copyright (c) 1985 Regents of the University of California.
* All rights reserved.
void
abort(void)
{
- struct atexit *p = __atexit;
- static int cleanup_called = 0;
sigset_t mask;
sigdelset(&mask, SIGABRT);
(void)_thread_sys_sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL);
- /*
- * POSIX requires we flush stdio buffers on abort
- */
- if (cleanup_called == 0) {
- /* the cleanup routine lives in fns[0] on the last page */
- while (p != NULL && p->next != NULL)
- p = p->next;
- /* the check for fn_dso == NULL is mostly paranoia */
- if (p != NULL && p->fns[0].fn_dso == NULL &&
- p->fns[0].fn_ptr.std_func != NULL) {
- cleanup_called = 1;
- (*p->fns[0].fn_ptr.std_func)();
- }
- }
-
(void)raise(SIGABRT);
/*