about summary refs log tree commit diff
path: root/elf/rtld.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-02-02 20:17:54 +0000
committerUlrich Drepper <drepper@redhat.com>2002-02-02 20:17:54 +0000
commit88794e308552d6051453544f8790986314fd9e1c (patch)
tree7811ea4e234dd21b1a49424ecfaaf95bda52e7b6 /elf/rtld.c
parent1e823b7d2dcbffb793be1e48b397d7c1a1b19a52 (diff)
downloadglibc-88794e308552d6051453544f8790986314fd9e1c.tar.gz
glibc-88794e308552d6051453544f8790986314fd9e1c.tar.xz
glibc-88794e308552d6051453544f8790986314fd9e1c.zip
Update.
	* 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 '/'.
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index 1efe38bc80..b835bd5dda 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -589,10 +589,17 @@ of this helper program; chances are you did not intend to run this program.\n\
 	   be our SONAME, and add it to our name list.  */
 	if (GL(dl_rtld_map).l_ld == NULL)
 	  {
-	    char *p = strrchr (_dl_rtld_libname.name, '/');
-	    if (p)
+	    const char *p = NULL;
+	    const char *cp = _dl_rtld_libname.name;
+
+	    /* Find the filename part of the path.  */
+	    while (*cp != '\0')
+	      if (*cp++ == '/')
+		p = cp;
+
+	    if (p != NULL)
 	      {
-		_dl_rtld_libname2.name = p+1;
+		_dl_rtld_libname2.name = p;
 		/* _dl_rtld_libname2.next = NULL;  Already zero.  */
 		_dl_rtld_libname.next = &_dl_rtld_libname2;
 	      }