diff options
author | brian <brian@FreeBSD.org> | 1998-06-07 03:53:08 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1998-06-07 03:53:08 +0000 |
commit | e484ff1d7f90f17b40abb5e8e798fd825e7d794a (patch) | |
tree | caeb949993ebe0fcc58ae3d2664a585ac3f0974e | |
parent | 9788b86904e822cdc2b714424b16288bf87f436c (diff) | |
download | FreeBSD-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>
-rw-r--r-- | libexec/rtld-aout/rtld.c | 13 | ||||
-rw-r--r-- | libexec/rtld-aout/shlib.c | 4 | ||||
-rw-r--r-- | libexec/rtld-aout/shlib.h | 4 |
3 files changed, 13 insertions, 8 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; diff --git a/libexec/rtld-aout/shlib.c b/libexec/rtld-aout/shlib.c index be92dff..34d88e9 100644 --- a/libexec/rtld-aout/shlib.c +++ b/libexec/rtld-aout/shlib.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: shlib.c,v 1.18 1997/02/22 15:46:24 peter Exp $ + * $Id: shlib.c,v 1.19 1998/05/26 20:12:49 sos Exp $ */ #include <sys/param.h> @@ -214,7 +214,7 @@ int do_dot_a; char * find_lib_file(name) - char *name; + const char *name; { int i; diff --git a/libexec/rtld-aout/shlib.h b/libexec/rtld-aout/shlib.h index 796d37e..e7d2211 100644 --- a/libexec/rtld-aout/shlib.h +++ b/libexec/rtld-aout/shlib.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. *- - * $Id$ + * $Id: shlib.h,v 1.3 1997/02/22 15:46:24 peter Exp $ */ /* @@ -39,5 +39,5 @@ void std_search_path __P((void)); int getdewey __P((int[], char *)); int cmpndewey __P((int[], int, int[], int)); char *findshlib __P((char *, int *, int *, int)); -char *find_lib_file __P((char *)); +char *find_lib_file __P((const char *)); char *search_lib_dir __P((char *, char *, int *, int *, int)); |