diff options
author | Paul Pluzhnikov <ppluzhnikov@google.com> | 2017-09-20 09:31:48 -0700 |
---|---|---|
committer | Paul Pluzhnikov <ppluzhnikov@google.com> | 2017-09-20 09:31:48 -0700 |
commit | 26e70aec7028feeb196744eb97cd2dff3670b7aa (patch) | |
tree | 0eb04d182ca05b4161b1cc0f6c59265da6ccb621 /stdlib/on_exit.c | |
parent | 0525ce4850f2c22a235dcd3422bc92f40815f377 (diff) | |
download | glibc-26e70aec7028feeb196744eb97cd2dff3670b7aa.zip glibc-26e70aec7028feeb196744eb97cd2dff3670b7aa.tar.gz glibc-26e70aec7028feeb196744eb97cd2dff3670b7aa.tar.bz2 |
Fix BZ 14333
Diffstat (limited to 'stdlib/on_exit.c')
-rw-r--r-- | stdlib/on_exit.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/stdlib/on_exit.c b/stdlib/on_exit.c index 83845e7..f4ede2b 100644 --- a/stdlib/on_exit.c +++ b/stdlib/on_exit.c @@ -17,25 +17,30 @@ #include <stdlib.h> #include "exit.h" -#include <atomic.h> #include <sysdep.h> /* Register a function to be called by exit. */ int __on_exit (void (*func) (int status, void *arg), void *arg) { - struct exit_function *new = __new_exitfn (&__exit_funcs); + struct exit_function *new; + + __libc_lock_lock (__exit_funcs_lock); + new = __new_exitfn (&__exit_funcs); if (new == NULL) - return -1; + { + __libc_lock_unlock (__exit_funcs_lock); + return -1; + } #ifdef PTR_MANGLE PTR_MANGLE (func); #endif new->func.on.fn = func; new->func.on.arg = arg; - atomic_write_barrier (); new->flavor = ef_on; + __libc_lock_unlock (__exit_funcs_lock); return 0; } weak_alias (__on_exit, on_exit) |