1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-17 18:21:03 +03:00

Fix BZ 14333

This commit is contained in:
Paul Pluzhnikov
2017-09-20 09:31:48 -07:00
parent 0525ce4850
commit 26e70aec70
11 changed files with 285 additions and 39 deletions

View File

@ -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)