summaryrefslogtreecommitdiffstats
path: root/libexec/rtld-aout/rtld.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1998-06-07 03:53:08 +0000
committerbrian <brian@FreeBSD.org>1998-06-07 03:53:08 +0000
commite484ff1d7f90f17b40abb5e8e798fd825e7d794a (patch)
treecaeb949993ebe0fcc58ae3d2664a585ac3f0974e /libexec/rtld-aout/rtld.c
parent9788b86904e822cdc2b714424b16288bf87f436c (diff)
downloadFreeBSD-src-e484ff1d7f90f17b40abb5e8e798fd825e7d794a.zip
FreeBSD-src-e484ff1d7f90f17b40abb5e8e798fd825e7d794a.tar.gz
Search for libraries in dlopen() when the specified path
contains no ``/''s. Elf already searches it seems. Mostly submitted by: Mike Smith <mike@smith.net.au>
Diffstat (limited to 'libexec/rtld-aout/rtld.c')
-rw-r--r--libexec/rtld-aout/rtld.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libexec/rtld-aout/rtld.c b/libexec/rtld-aout/rtld.c
index 2897302..5239c38 100644
--- a/libexec/rtld-aout/rtld.c
+++ b/libexec/rtld-aout/rtld.c
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: rtld.c,v 1.52 1998/02/06 16:46:46 jdp Exp $
+ * $Id: rtld.c,v 1.53 1998/05/26 20:12:51 sos Exp $
*/
#include <sys/param.h>
@@ -242,7 +242,7 @@ static void init_external_malloc __P((void));
static int call_map __P((struct so_map *, char *));
static char *findhint __P((char *, int, int *));
static char *rtfindlib __P((char *, int, int));
-static char *rtfindfile __P((char *));
+static char *rtfindfile __P((const char *));
void binder_entry __P((void));
long binder __P((jmpslot_t *));
static struct nzlist *lookup __P((char *, struct so_map **, int));
@@ -1851,7 +1851,7 @@ rtfindlib(name, major, minor)
*/
static char *
rtfindfile(name)
- char *name;
+ const char *name;
{
char *ld_path = ld_library_path;
char *path = NULL;
@@ -1902,6 +1902,7 @@ __dlopen(path, mode)
struct so_map *old_tail = link_map_tail;
struct so_map *smp;
int bind_now = mode == RTLD_NOW;
+ char *name;
/*
* path == NULL is handled by map_object()
@@ -1909,8 +1910,12 @@ __dlopen(path, mode)
anon_open();
+ name = (path && strchr(path, '/') == NULL) ? rtfindfile(path) : (char *)path;
+
/* Map the object, and the objects on which it depends */
- smp = map_object(path, (struct sod *) NULL, (struct so_map *) NULL);
+ smp = map_object(name, (struct sod *) NULL, (struct so_map *) NULL);
+ if (name != path)
+ free(name);
if(smp == NULL) /* Failed */
return NULL;
LM_PRIVATE(smp)->spd_flags |= RTLD_DL;
OpenPOWER on IntegriCloud