summary refs log tree commit diff
path: root/htl
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-06-07 02:57:04 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-06-07 03:00:22 +0200
commit6c5ca98d096a5f61144555c76fdfd3c2ad561082 (patch)
tree3471e660a075199f3fc0de615c3c6864d45c6c04 /htl
parentfab94894d5c5b25d24010f823515fb53822d6623 (diff)
downloadglibc-6c5ca98d096a5f61144555c76fdfd3c2ad561082.tar.gz
glibc-6c5ca98d096a5f61144555c76fdfd3c2ad561082.tar.xz
glibc-6c5ca98d096a5f61144555c76fdfd3c2ad561082.zip
htl: fix register-atfork ordering
* htl/register-atfork.c (__register_atfork): Add new hooks at the end of
the list instead of the beginning.
Diffstat (limited to 'htl')
-rw-r--r--htl/register-atfork.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/htl/register-atfork.c b/htl/register-atfork.c
index 256b1148ac..4581ac5bba 100644
--- a/htl/register-atfork.c
+++ b/htl/register-atfork.c
@@ -109,15 +109,15 @@ __register_atfork (void (*prepare) (void),
   new->parent = parent;
   new->child = child;
   new->dso_handle = dso_handle;
-  new->prev = NULL;
+  new->next = NULL;
 
   __libc_lock_lock (atfork_lock);
-  new->next = fork_handlers;
-  if (fork_handlers != NULL)
-    fork_handlers->prev = new;
-  fork_handlers = new;
-  if (fork_last_handler == NULL)
-    fork_last_handler = new;
+  new->prev = fork_last_handler;
+  if (fork_last_handler != NULL)
+    fork_last_handler->next = new;
+  if (fork_handlers == NULL)
+    fork_handlers = new;
+  fork_last_handler = new;
   __libc_lock_unlock (atfork_lock);
 
   return 0;