summaryrefslogtreecommitdiff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-07-17 23:09:43 +0000
committerRoland McGrath <roland@gnu.org>1996-07-17 23:09:43 +0000
commitf18edac3a387b956579f7a5ed0e46322c83432b2 (patch)
tree354b64ed298f71755f403674dfc0e7d8dd5abaf0 /elf/dl-load.c
parent3867ee645cc03dba836667728d60cabbae111255 (diff)
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.
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 29ac0bfd87..fc2733252a 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -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)
{