diff options
| author | millert <> | 2007-09-03 14:40:16 +0000 | 
|---|---|---|
| committer | millert <> | 2007-09-03 14:40:16 +0000 | 
| commit | 7e0e6a2581ab1d1bca602865b8e38dfa2f54424a (patch) | |
| tree | 276e35092c38431624dd4e601442d98afb2a617d /src/lib/libc/stdlib/abort.c | |
| parent | 2056049ed6b7a028e611838a742280fced6d2c23 (diff) | |
| download | openbsd-7e0e6a2581ab1d1bca602865b8e38dfa2f54424a.tar.gz openbsd-7e0e6a2581ab1d1bca602865b8e38dfa2f54424a.tar.bz2 openbsd-7e0e6a2581ab1d1bca602865b8e38dfa2f54424a.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 'src/lib/libc/stdlib/abort.c')
| -rw-r--r-- | src/lib/libc/stdlib/abort.c | 9 | 
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/libc/stdlib/abort.c b/src/lib/libc/stdlib/abort.c index 072a9fa8c1..244e3b28aa 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.14 2005/08/08 08:05:36 espie Exp $ */ | 1 | /* $OpenBSD: abort.c,v 1.15 2007/09/03 14:40:16 millert 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. | 
| @@ -54,11 +54,14 @@ abort(void) | |||
| 54 | * POSIX requires we flush stdio buffers on abort | 54 | * POSIX requires we flush stdio buffers on abort | 
| 55 | */ | 55 | */ | 
| 56 | if (cleanup_called == 0) { | 56 | if (cleanup_called == 0) { | 
| 57 | /* the cleanup routine lives in fns[0] on the last page */ | ||
| 57 | while (p != NULL && p->next != NULL) | 58 | while (p != NULL && p->next != NULL) | 
| 58 | p = p->next; | 59 | p = p->next; | 
| 59 | if (p != NULL && p->fns[0] != NULL) { | 60 | /* the check for fn_dso == NULL is mostly paranoia */ | 
| 61 | if (p != NULL && p->fns[0].fn_dso == NULL && | ||
| 62 | p->fns[0].fn_ptr.std_func != NULL) { | ||
| 60 | cleanup_called = 1; | 63 | cleanup_called = 1; | 
| 61 | (*p->fns[0])(); | 64 | (*p->fns[0].fn_ptr.std_func)(); | 
| 62 | } | 65 | } | 
| 63 | } | 66 | } | 
| 64 | 67 | ||
