summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/abort.c
diff options
context:
space:
mode:
authortedu <>2014-05-14 21:54:20 +0000
committertedu <>2014-05-14 21:54:20 +0000
commit8b25899b4c04e7b25fb2318b51b6390f9d5474e8 (patch)
tree02ceb5d8eaaa1f26fbd3f43d2a51682a643ca073 /src/lib/libc/stdlib/abort.c
parentd80a509f5bc6ebb6406df372d83531863fa297e8 (diff)
downloadopenbsd-8b25899b4c04e7b25fb2318b51b6390f9d5474e8.tar.gz
openbsd-8b25899b4c04e7b25fb2318b51b6390f9d5474e8.tar.bz2
openbsd-8b25899b4c04e7b25fb2318b51b6390f9d5474e8.zip
stop flushing streams in abort(). it's hackish and unsafe, and no longer
required. try to document this fact and some of the history. with feedback from deraadt guenther millert
Diffstat (limited to 'src/lib/libc/stdlib/abort.c')
-rw-r--r--src/lib/libc/stdlib/abort.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/src/lib/libc/stdlib/abort.c b/src/lib/libc/stdlib/abort.c
index 4c8dc70a1d..dd057710ff 100644
--- a/src/lib/libc/stdlib/abort.c
+++ b/src/lib/libc/stdlib/abort.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: abort.c,v 1.16 2012/11/10 03:46:11 guenther Exp $ */ 1/* $OpenBSD: abort.c,v 1.17 2014/05/14 21:54:20 tedu Exp $ */
2/* 2/*
3 * Copyright (c) 1985 Regents of the University of California. 3 * Copyright (c) 1985 Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -39,8 +39,6 @@ int _thread_sys_sigprocmask(int, const sigset_t *, sigset_t *);
39void 39void
40abort(void) 40abort(void)
41{ 41{
42 struct atexit *p = __atexit;
43 static int cleanup_called = 0;
44 sigset_t mask; 42 sigset_t mask;
45 43
46 44
@@ -52,21 +50,6 @@ abort(void)
52 sigdelset(&mask, SIGABRT); 50 sigdelset(&mask, SIGABRT);
53 (void)_thread_sys_sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); 51 (void)_thread_sys_sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL);
54 52
55 /*
56 * POSIX requires we flush stdio buffers on abort
57 */
58 if (cleanup_called == 0) {
59 /* the cleanup routine lives in fns[0] on the last page */
60 while (p != NULL && p->next != NULL)
61 p = p->next;
62 /* the check for fn_dso == NULL is mostly paranoia */
63 if (p != NULL && p->fns[0].fn_dso == NULL &&
64 p->fns[0].fn_ptr.std_func != NULL) {
65 cleanup_called = 1;
66 (*p->fns[0].fn_ptr.std_func)();
67 }
68 }
69
70 (void)raise(SIGABRT); 53 (void)raise(SIGABRT);
71 54
72 /* 55 /*