aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
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;
}