diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libc/stdlib/atexit.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/libc/stdlib/atexit.c b/src/lib/libc/stdlib/atexit.c index a44de37c88..83cc1282a9 100644 --- a/src/lib/libc/stdlib/atexit.c +++ b/src/lib/libc/stdlib/atexit.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: atexit.c,v 1.23 2015/10/25 18:03:17 guenther Exp $ */ | 1 | /* $OpenBSD: atexit.c,v 1.24 2015/11/10 04:14:03 guenther Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2002 Daniel Hartmeier | 3 | * Copyright (c) 2002 Daniel Hartmeier |
4 | * All rights reserved. | 4 | * All rights reserved. |
@@ -110,6 +110,18 @@ unlock: | |||
110 | DEF_STRONG(__cxa_atexit); | 110 | DEF_STRONG(__cxa_atexit); |
111 | 111 | ||
112 | /* | 112 | /* |
113 | * Copy of atexit() used by libc and anything staticly linked into the | ||
114 | * executable. This passes NULL for the dso, so the callbacks are only | ||
115 | * invoked by exit() and not dlclose() | ||
116 | */ | ||
117 | int | ||
118 | atexit(void (*fn)(void)) | ||
119 | { | ||
120 | return (__cxa_atexit((void (*)(void *))fn, NULL, NULL)); | ||
121 | } | ||
122 | DEF_STRONG(atexit); | ||
123 | |||
124 | /* | ||
113 | * Call all handlers registered with __cxa_atexit() for the shared | 125 | * Call all handlers registered with __cxa_atexit() for the shared |
114 | * object owning 'dso'. | 126 | * object owning 'dso'. |
115 | * Note: if 'dso' is NULL, then all remaining handlers are called. | 127 | * Note: if 'dso' is NULL, then all remaining handlers are called. |