diff options
author | 2002-03-17 04:50:57 +0000 | |
---|---|---|
committer | 2002-03-17 04:50:57 +0000 | |
commit | 166b3c7f9708a82893f3cf28f1e0f3549e77e348 (patch) | |
tree | f2f804f8997b732f0a67b309f68debaf2523d5c1 | |
parent | Keep _dl_last_object in sync with reality if last element in list is deleted. (diff) | |
download | wireguard-openbsd-166b3c7f9708a82893f3cf28f1e0f3549e77e348.tar.xz wireguard-openbsd-166b3c7f9708a82893f3cf28f1e0f3549e77e348.zip |
Remove hackery I added to deal with dlopen(NULL), handle it in a reasonably
sane manner. This and the previous resolve.c change art@ ok
-rw-r--r-- | libexec/ld.so/dlfcn.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/libexec/ld.so/dlfcn.c b/libexec/ld.so/dlfcn.c index 54a90013851..3451600b5a8 100644 --- a/libexec/ld.so/dlfcn.c +++ b/libexec/ld.so/dlfcn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dlfcn.c,v 1.13 2002/03/07 00:54:09 art Exp $ */ +/* $OpenBSD: dlfcn.c,v 1.14 2002/03/17 04:50:57 drahn Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -58,7 +58,7 @@ dlopen(const char *libname, int how) Elf_Dyn *dynp; if (libname == NULL) { - return NULL; + return _dl_objects; } DL_DEB(("dlopen: loading: %s\n", libname)); @@ -122,16 +122,6 @@ dlsym(void *handle, const char *name) void *retval; const Elf_Sym *sym = NULL; - if (handle == NULL) { - object = _dl_objects; - retval = (void *)_dl_find_symbol(name, object, &sym, 1, 1); - if (sym != NULL) { - retval += sym->st_value; - } else { - _dl_errno = DL_NO_SYMBOL; - } - return retval; - } object = (elf_object_t *)handle; dynobj = _dl_objects; while (dynobj && dynobj != object) { @@ -175,6 +165,9 @@ dlclose(void *handle) { int retval; + if (handle == _dl_objects) { + return 0; + } retval = _dl_real_close(handle); if (_dl_debug_map->r_brk) { |