diff options
author | kettenis <> | 2014-06-18 19:01:10 +0000 |
---|---|---|
committer | kettenis <> | 2014-06-18 19:01:10 +0000 |
commit | ea52171d7ee0bb85a996dc2021440e122bf0357d (patch) | |
tree | 25ba00731ee7e34a8f0bb9da9731d10eba63a790 /src/lib/libc/stdlib/atexit.h | |
parent | 067b361c7dbce14db401c57d13ca4e1146dedc3c (diff) | |
download | openbsd-ea52171d7ee0bb85a996dc2021440e122bf0357d.tar.gz openbsd-ea52171d7ee0bb85a996dc2021440e122bf0357d.tar.bz2 openbsd-ea52171d7ee0bb85a996dc2021440e122bf0357d.zip |
Always call atexit handlers as if they were registered with __cxa_atexit.
The extra argument doesn't hurt genuine atexit handlers and this fixes a
bug where we didn't provide the argument (effectively passing garbage) for
functions registered with __cxa_atexit in the main executable.
Pointed out by Dmitriy Ivanov <dimitry@google.com> and Elliott Hughes
<enh@google.com>.
ok matthew@
Diffstat (limited to 'src/lib/libc/stdlib/atexit.h')
-rw-r--r-- | src/lib/libc/stdlib/atexit.h | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/lib/libc/stdlib/atexit.h b/src/lib/libc/stdlib/atexit.h index c44005deda..3de2aa3bf6 100644 --- a/src/lib/libc/stdlib/atexit.h +++ b/src/lib/libc/stdlib/atexit.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: atexit.h,v 1.8 2013/06/02 21:08:36 matthew Exp $ */ | 1 | /* $OpenBSD: atexit.h,v 1.9 2014/06/18 19:01:10 kettenis Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2002 Daniel Hartmeier | 4 | * Copyright (c) 2002 Daniel Hartmeier |
@@ -35,10 +35,7 @@ struct atexit { | |||
35 | int ind; /* next index in this table */ | 35 | int ind; /* next index in this table */ |
36 | int max; /* max entries >= ATEXIT_SIZE */ | 36 | int max; /* max entries >= ATEXIT_SIZE */ |
37 | struct atexit_fn { | 37 | struct atexit_fn { |
38 | union { | 38 | void (*fn_ptr)(void *); |
39 | void (*std_func)(void); | ||
40 | void (*cxa_func)(void *); | ||
41 | } fn_ptr; | ||
42 | void *fn_arg; /* argument for CXA callback */ | 39 | void *fn_arg; /* argument for CXA callback */ |
43 | void *fn_dso; /* shared module handle */ | 40 | void *fn_dso; /* shared module handle */ |
44 | } fns[1]; /* the table itself */ | 41 | } fns[1]; /* the table itself */ |