summaryrefslogtreecommitdiff
path: root/stdlib/on_exit.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /stdlib/on_exit.c
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
downloadglibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz
2.5-18.1
Diffstat (limited to 'stdlib/on_exit.c')
-rw-r--r--stdlib/on_exit.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/stdlib/on_exit.c b/stdlib/on_exit.c
index d98fbb3a86..e777604084 100644
--- a/stdlib/on_exit.c
+++ b/stdlib/on_exit.c
@@ -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)