summaryrefslogtreecommitdiff
path: root/libexec/ld.so/library_mquery.c
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2005-04-05 19:29:10 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2005-04-05 19:29:10 +0000
commit89c5196820bb38412fa7d291f3a10dd4dfbda71d (patch)
tree6687cb51539366828e7a33bcb0229a721a47b267 /libexec/ld.so/library_mquery.c
parentec2a10f3444e39a36e94bccf99c9b3ffaf76695e (diff)
Do a better job of running destructors in the right order.
Diffstat (limited to 'libexec/ld.so/library_mquery.c')
-rw-r--r--libexec/ld.so/library_mquery.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/libexec/ld.so/library_mquery.c b/libexec/ld.so/library_mquery.c
index 2fa1165d627..61807f55fa0 100644
--- a/libexec/ld.so/library_mquery.c
+++ b/libexec/ld.so/library_mquery.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: library_mquery.c,v 1.16 2005/03/23 19:48:05 drahn Exp $ */
+/* $OpenBSD: library_mquery.c,v 1.17 2005/04/05 19:29:09 drahn Exp $ */
/*
* Copyright (c) 2002 Dale Rahn
@@ -59,12 +59,27 @@ _dl_load_list_free(struct load_list *load_list)
}
void
+_dl_notify_unload_shlib(elf_object_t *object)
+{
+ struct dep_node *n;
+
+ if (--object->refcount == 0)
+ for (n = object->first_child; n; n = n->next_sibling)
+ _dl_notify_unload_shlib(n->data);
+}
+
+void
_dl_unload_shlib(elf_object_t *object)
{
- if (--object->refcount == 0) {
- _dl_run_dtors(object);
+ struct dep_node *n;
+
+ if (object->refcount == 0) {
_dl_load_list_free(object->load_list);
_dl_remove_object(object);
+
+ for (n = object->first_child; n; n = n->next_sibling) {
+ _dl_unload_shlib(n->data);
+ }
}
}