mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-01 10:06:57 +03:00
Wed Jul 17 21:53:45 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* elf/Makefile (dl-routines): Add dl-cache. * elf/dl-cache.c: New file. * elf/dl-load.c (_dl_map_object): Check cache before default path.
This commit is contained in:
@ -513,6 +513,29 @@ _dl_map_object (struct link_map *loader, const char *name, int type)
|
||||
/* Try an environment variable (unless setuid). */
|
||||
if (fd == -1 && ! _dl_secure)
|
||||
trypath (getenv ("LD_LIBRARY_PATH"));
|
||||
if (fd == -1)
|
||||
{
|
||||
/* Check the list of libraries in the file /etc/ld.so.cache,
|
||||
for compatibility with Linux's ldconfig program. */
|
||||
extern const char *_dl_load_cache_lookup (const char *name);
|
||||
const char *cached = _dl_load_cache_lookup (name);
|
||||
if (cached)
|
||||
{
|
||||
fd = __open (cached, O_RDONLY);
|
||||
if (fd != -1)
|
||||
{
|
||||
size_t cl = strlen (cached) + 1;
|
||||
realname = malloc (cl);
|
||||
if (realname)
|
||||
memcpy (realname, cached, cl);
|
||||
else
|
||||
{
|
||||
__close (fd);
|
||||
fd = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Finally, try the default path. */
|
||||
if (fd == -1)
|
||||
{
|
||||
|
Reference in New Issue
Block a user