summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtchang%redhat.com <devnull@localhost>2005-02-05 02:00:33 +0000
committerwtchang%redhat.com <devnull@localhost>2005-02-05 02:00:33 +0000
commit82caac4189a5db5601c4ce7e908740c6e39a360b (patch)
tree9be9743d28d34f3259a417fd008e270ba6cd6039
parent18ad452bb3dac4b82adf1788d8cf2c4ea69bd68b (diff)
downloadnspr-hg-82caac4189a5db5601c4ce7e908740c6e39a360b.tar.gz
Bugzilla Bug 280984: need to pass the L_IGNOREUNLOAD flag to loadquery so
that shared libraries that have been dlclose'd but with nonzero ref count will be listed. Also use function address test, which is more reliable than file name test. The patch is contributed by Philip K. Warren (IBM) <pkwarren@gmail.com>. r=wtc. Tag: NSPRPUB_PRE_4_2_CLIENT_BRANCH
-rw-r--r--pr/src/linking/prlink.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/pr/src/linking/prlink.c b/pr/src/linking/prlink.c
index ccf1a3c2..1b14058a 100644
--- a/pr/src/linking/prlink.c
+++ b/pr/src/linking/prlink.c
@@ -1760,7 +1760,7 @@ PR_GetLibraryFilePathname(const char *name, PRFuncPtr addr)
return NULL;
}
/* If buffer is too small, loadquery fails with ENOMEM. */
- if (loadquery(L_GETINFO, info, info_length) != -1) {
+ if (loadquery(L_GETINFO | L_IGNOREUNLOAD, info, info_length) != -1) {
break;
}
PR_Free(info);
@@ -1776,7 +1776,9 @@ PR_GetLibraryFilePathname(const char *name, PRFuncPtr addr)
for (infop = info;
;
infop = (struct ld_info *)((char *)infop + infop->ldinfo_next)) {
- if (strstr(infop->ldinfo_filename, name) != NULL) {
+ unsigned long start = (unsigned long)infop->ldinfo_dataorg;
+ unsigned long end = start + infop->ldinfo_datasize;
+ if (start <= (unsigned long)addr && end > (unsigned long)addr) {
result = PR_Malloc(strlen(infop->ldinfo_filename)+1);
if (result != NULL) {
strcpy(result, infop->ldinfo_filename);