diff options
author | kettenis <> | 2013-12-28 18:38:42 +0000 |
---|---|---|
committer | kettenis <> | 2013-12-28 18:38:42 +0000 |
commit | 059e8d1417ca56903c7f426e4a8a23db0b19a7e7 (patch) | |
tree | 938d46655895003567e488cc45a151e8240a82ab | |
parent | 80578de9d4665c9f00dd5d4f1e96f2547d56e4d1 (diff) | |
download | openbsd-059e8d1417ca56903c7f426e4a8a23db0b19a7e7.tar.gz openbsd-059e8d1417ca56903c7f426e4a8a23db0b19a7e7.tar.bz2 openbsd-059e8d1417ca56903c7f426e4a8a23db0b19a7e7.zip |
Move atexit(3) into crtbegin.c and certbeginS.c such that we can pass the
right __dso_handle and have dlopen'ed shared objects run their atexit handlers
when they get unloaded. This is what Linux does, and several ports depend on
this behaviour (and will crash upon exit without this chang).
Based on an earlier diff from matthew@
Tested by ajacoutot@
ok deraadt@
-rw-r--r-- | src/lib/libc/stdlib/atexit.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/src/lib/libc/stdlib/atexit.c b/src/lib/libc/stdlib/atexit.c index 52f1cf3c5c..049da3261d 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.16 2013/06/02 21:08:36 matthew Exp $ */ | 1 | /* $OpenBSD: atexit.c,v 1.17 2013/12/28 18:38:42 kettenis Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2002 Daniel Hartmeier | 3 | * Copyright (c) 2002 Daniel Hartmeier |
4 | * All rights reserved. | 4 | * All rights reserved. |
@@ -102,15 +102,6 @@ unlock: | |||
102 | } | 102 | } |
103 | 103 | ||
104 | /* | 104 | /* |
105 | * Register a function to be performed at exit. | ||
106 | */ | ||
107 | int | ||
108 | atexit(void (*func)(void)) | ||
109 | { | ||
110 | return (__cxa_atexit((void (*)(void *))func, NULL, NULL)); | ||
111 | } | ||
112 | |||
113 | /* | ||
114 | * Call all handlers registered with __cxa_atexit() for the shared | 105 | * Call all handlers registered with __cxa_atexit() for the shared |
115 | * object owning 'dso'. | 106 | * object owning 'dso'. |
116 | * Note: if 'dso' is NULL, then all remaining handlers are called. | 107 | * Note: if 'dso' is NULL, then all remaining handlers are called. |