diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-12-18 17:32:37 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-12-18 17:32:37 +0000 |
commit | a3c88553729c1c4dcd4f893a96b4668bce640ee5 (patch) | |
tree | d6660a25aa0a3a8b86fccfe2efbd2155e0893e97 /stdlib/exit.c | |
parent | 3467f5c369a10ef19c8df38fb282c7763f36d66f (diff) | |
download | glibc-a3c88553729c1c4dcd4f893a96b4668bce640ee5.tar.gz glibc-a3c88553729c1c4dcd4f893a96b4668bce640ee5.tar.xz glibc-a3c88553729c1c4dcd4f893a96b4668bce640ee5.zip |
* stdlib/cxa_atexit.c: Use PTR_MANGLE on function pointer. Fill in
flavor field last and protect with memory barrier. * stdlib/on_exit.c: Likewise. * stdlib/cxa_finalize.c: Use PTR_DEMANGLE on function pointer before using it. * stdlib/exit.c: Likewise.
Diffstat (limited to 'stdlib/exit.c')
-rw-r--r-- | stdlib/exit.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/stdlib/exit.c b/stdlib/exit.c index e5e25960b1..bc4cb0fd08 100644 --- a/stdlib/exit.c +++ b/stdlib/exit.c @@ -19,6 +19,7 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <sysdep.h> #include "exit.h" #include "set-hooks.h" @@ -45,17 +46,33 @@ exit (int status) &__exit_funcs->fns[--__exit_funcs->idx]; switch (f->flavor) { + void (*atfct) (void); + void (*onfct) (int status, void *arg); + void (*cxafct) (void *arg, int status); + case ef_free: case ef_us: break; case ef_on: - (*f->func.on.fn) (status, f->func.on.arg); + onfct = f->func.on.fn; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (onfct); +#endif + onfct (status, f->func.on.arg); break; case ef_at: - (*f->func.at) (); + atfct = f->func.at; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (atfct); +#endif + atfct (); break; case ef_cxa: - (*f->func.cxa.fn) (f->func.cxa.arg, status); + cxafct = f->func.cxa.fn; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (cxafct); +#endif + cxafct (f->func.cxa.arg, status); break; } } |