1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00
* elf/dl-object.c (_dl_new_object): Avoid using strrchr.  We have
	more information.
	* elf/rtld.c (dl_main): Avoid strrchr.
	* sysdeps/unix/sysv/linux/dl-origin.c (_dl_get_origin): Use the
	result of readlink.  Search from the back for '/'.
This commit is contained in:
Ulrich Drepper
2002-02-02 20:17:54 +00:00
parent 1e823b7d2d
commit 88794e3085
4 changed files with 35 additions and 15 deletions

View File

@ -150,15 +150,18 @@ _dl_new_object (char *realname, const char *libname, int type,
}
/* Add the real file name. */
memcpy (cp, realname, realname_len);
cp = __mempcpy (cp, realname, realname_len);
/* Now remove the filename and the slash. Leave the slash if it
/* Now remove the filename and the slash. Leave the slash if
the name is something like "/foo". */
cp = strrchr (origin, '/');
do
--cp;
while (*cp != '/');
if (cp == origin)
origin[1] = '\0';
else
*cp = '\0';
/* Keep the only slash which is the first character. */
++cp;
*cp = '\0';
out:
new->l_origin = origin;