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>
This commit is contained in:
Brian Somers 1998-06-07 03:53:08 +00:00
parent a2b023b187
commit 32b8743969
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=36717
3 changed files with 13 additions and 8 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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));