1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +03:00

* 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.
This commit is contained in:
Ulrich Drepper
2005-12-18 17:32:37 +00:00
parent 3467f5c369
commit a3c8855372
5 changed files with 51 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1996, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -18,6 +18,8 @@
#include <stdlib.h>
#include "exit.h"
#include <atomic.h>
#include <sysdep.h>
/* Register a function to be called by exit. */
int
@@ -28,9 +30,13 @@ __on_exit (void (*func) (int status, void *arg), void *arg)
if (new == NULL)
return -1;
new->flavor = ef_on;
#ifdef PTR_MANGLE
PTR_MANGLE (func);
#endif
new->func.on.fn = func;
new->func.on.arg = arg;
atomic_write_barrier ();
new->flavor = ef_on;
return 0;
}
weak_alias (__on_exit, on_exit)