summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/abort.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2007-09-03 14:40:16 +0000
committermillert <millert@openbsd.org>2007-09-03 14:40:16 +0000
commit5198527c0e2957645fda7040dfcb34da8197dcbd (patch)
tree0b140144618ef8fbe4bb1dcc3bf8af81c3ffd235 /lib/libc/stdlib/abort.c
parentAdd ENOMSG and EIDRM; from jsg@ (diff)
downloadwireguard-openbsd-5198527c0e2957645fda7040dfcb34da8197dcbd.tar.xz
wireguard-openbsd-5198527c0e2957645fda7040dfcb34da8197dcbd.zip
Add __cxa_atexit() support for gcc3. This provides support for shared object destructors called at dlclose() time. Inspired by similar changes in FreeBSD and NetBSD.
Diffstat (limited to 'lib/libc/stdlib/abort.c')
-rw-r--r--lib/libc/stdlib/abort.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libc/stdlib/abort.c b/lib/libc/stdlib/abort.c
index 072a9fa8c11..244e3b28aa2 100644
--- a/lib/libc/stdlib/abort.c
+++ b/lib/libc/stdlib/abort.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: abort.c,v 1.14 2005/08/08 08:05:36 espie Exp $ */
+/* $OpenBSD: abort.c,v 1.15 2007/09/03 14:40:16 millert Exp $ */
/*
* Copyright (c) 1985 Regents of the University of California.
* All rights reserved.
@@ -54,11 +54,14 @@ abort(void)
* 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;
- if (p != NULL && p->fns[0] != NULL) {
+ /* 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])();
+ (*p->fns[0].fn_ptr.std_func)();
}
}