aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-02-19 00:00:05 +0000
committerUlrich Drepper <drepper@redhat.com>1999-02-19 00:00:05 +0000
commit61e0617ac34c4daaeb2f07f89a05c9f9353b8879 (patch)
tree8dc1f2e00b67c6661892258bf2d479e793854c54 /elf/dl-load.c
parent1a989e004c00955e60cd315666ebd450d6fa9732 (diff)
downloadglibc-61e0617ac34c4daaeb2f07f89a05c9f9353b8879.zip
glibc-61e0617ac34c4daaeb2f07f89a05c9f9353b8879.tar.gz
glibc-61e0617ac34c4daaeb2f07f89a05c9f9353b8879.tar.bz2
Update.
* elf/link.h (link_map): Add l_dev and l_ino. * elf/dl-load.c (_dl_map_object_from_fd): Test dev/ino of newly loaded shared object with all laoded objects. Initialize l_ino and l_dev in case it's new. * elf/rtld.c (dl_main): Explain situation is l_dev/l_ino with main object. * elf/Makefile: Compile and run new test. * elf/multiload.c: New file.
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 84951ea..bf3e419 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -602,10 +602,15 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname,
int type;
char *readbuf;
ssize_t readlength;
+ struct stat st;
+
+ /* Get file information. */
+ if (__fstat (fd, &st) < 0)
+ lose (errno, "cannot stat shared object");
/* Look again to see if the real name matched another already loaded. */
for (l = _dl_loaded; l; l = l->l_next)
- if (! strcmp (realname, l->l_name))
+ if (l->l_ino == st.st_ino && l->l_dev == st.st_dev)
{
/* The object is already loaded.
Just bump its reference count and return it. */
@@ -961,6 +966,10 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname,
l->l_scope[0] = &l->l_symbolic_searchlist;
}
+ /* Finally the file information. */
+ l->l_dev = st.st_dev;
+ l->l_ino = st.st_ino;
+
return l;
}