1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-01 10:06:57 +03:00
* 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.
This commit is contained in:
Ulrich Drepper
1999-02-19 00:00:05 +00:00
parent 1a989e004c
commit 61e0617ac3
6 changed files with 128 additions and 5 deletions

View File

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