summaryrefslogtreecommitdiff
path: root/libexec/ld.so/library_mquery.c
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2005-10-01 19:32:23 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2005-10-01 19:32:23 +0000
commit34cc8abaf39119e92cdf89258a084f4d8ccb1749 (patch)
treed0ecf55e51e19034482806c45159b67034eb408f /libexec/ld.so/library_mquery.c
parent038a92308d23043d05543461cc755bf9140d5e3b (diff)
handle references to load groups caused by dlopen()ing of depenant
members of the load group. work by kurt@ and myself
Diffstat (limited to 'libexec/ld.so/library_mquery.c')
-rw-r--r--libexec/ld.so/library_mquery.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/libexec/ld.so/library_mquery.c b/libexec/ld.so/library_mquery.c
index 49d6944ab93..a0b3532825f 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.26 2005/09/28 21:56:24 drahn Exp $ */
+/* $OpenBSD: library_mquery.c,v 1.27 2005/10/01 19:32:22 drahn Exp $ */
/*
* Copyright (c) 2002 Dale Rahn
@@ -97,6 +97,14 @@ _dl_tryload_shlib(const char *libname, int type, int flags)
if (object) {
object->refcount++;
object->load_object->obj_flags |= flags & RTLD_GLOBAL;
+ if (object->load_object != object &&
+ object->load_object != _dl_objects &&
+ object->load_object != _dl_loading_object) {
+ object->load_object->refcount++;
+ if (_dl_loading_object == NULL)
+ _dl_loading_object = object;
+ _dl_link_sub(object->load_object, _dl_loading_object);
+ }
return(object); /* Already loaded */
}
@@ -117,6 +125,15 @@ _dl_tryload_shlib(const char *libname, int type, int flags)
object->refcount++;
object->load_object->obj_flags |= flags & RTLD_GLOBAL;
_dl_close(libfile);
+ if (object->load_object != object &&
+ object->load_object != _dl_objects &&
+ object->load_object != _dl_loading_object) {
+ object->load_object->refcount++;
+ if (_dl_loading_object == NULL)
+ _dl_loading_object = object;
+ _dl_link_sub(object->load_object,
+ _dl_loading_object);
+ }
return(object);
}
}