summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Miller <kurt@cvs.openbsd.org>2004-12-01 22:27:36 +0000
committerKurt Miller <kurt@cvs.openbsd.org>2004-12-01 22:27:36 +0000
commit3418dc7650a22243502c98ff5b10a5eb407bfa7d (patch)
treefe3a1c12a3a3a94db0de22f08bf0c8d93fa8ba99
parent227aae4d7f952166df3178a7e2888a43d4043334 (diff)
fix dlsym(RTLD_NEXT,...) when called from the last shared object
loaded. ok drahn@
-rw-r--r--libexec/ld.so/dlfcn.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libexec/ld.so/dlfcn.c b/libexec/ld.so/dlfcn.c
index 6b534ec2c8b..f750540c262 100644
--- a/libexec/ld.so/dlfcn.c
+++ b/libexec/ld.so/dlfcn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dlfcn.c,v 1.41 2004/10/14 10:02:28 kettenis Exp $ */
+/* $OpenBSD: dlfcn.c,v 1.42 2004/12/01 22:27:35 kurt Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -143,8 +143,13 @@ dlsym(void *handle, const char *name)
return(0);
}
- if (handle == RTLD_NEXT)
+ if (handle == RTLD_NEXT) {
object = object->next;
+ if (object == NULL) {
+ _dl_errno = DL_NO_SYMBOL;
+ return(0);
+ }
+ }
if (handle == NULL)
flags = SYM_SEARCH_SELF|SYM_PLT;