summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-09-02 12:58:42 +0000
committerUlrich Drepper <drepper@redhat.com>1998-09-02 12:58:42 +0000
commit143e2b96c94c3fd5a2c618db0bad094ce659e743 (patch)
treeeea1289a952261584269f3ffeadf4137a1924706 /sysdeps
parent4ce636da6cf71061410da841e12b27b5f551e879 (diff)
downloadglibc-143e2b96c94c3fd5a2c618db0bad094ce659e743.tar.gz
glibc-143e2b96c94c3fd5a2c618db0bad094ce659e743.tar.xz
glibc-143e2b96c94c3fd5a2c618db0bad094ce659e743.zip
Update.
1998-09-02  Ulrich Drepper  <drepper@cygnus.com>

	* elf/dl-load.c (fillin_rpath): Handle "/" as RPATH correctly.
	(_dl_map_object_from_fd): Make NAME argument const.
	Remove last parameter in _dl_new_object call.
	(print_search_path): Correct construction of composed path name.
	(_dl_map_object): Prevent looking at RPATH of the main map twice.
	Remove last parameter in _dl_new_object call.
	* elf/dl-object.c: Remove last parameter.  Determine whether create
	origin entry based on empty realname.  Handle file in root directory
	correctly.
	* elf/ldsodefs.h: Adjust prototype for _dl_new_object.
	* elf/rtld.c (dl_main): Add comment describing reason for memory leak.
	Remove last parameter in _dl_new_object call.
	* sysdeps/generic/dl-origin.h: Handle file in root directory correctly.
	* sysdeps/unix/sysv/linux/dl-origin.h: Likewise.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/dl-origin.h4
-rw-r--r--sysdeps/unix/sysv/linux/dl-origin.h6
2 files changed, 6 insertions, 4 deletions
diff --git a/sysdeps/generic/dl-origin.h b/sysdeps/generic/dl-origin.h
index 6d5a8da52e..495df60296 100644
--- a/sysdeps/generic/dl-origin.h
+++ b/sysdeps/generic/dl-origin.h
@@ -26,7 +26,7 @@ static inline const char *
 get_origin (void)
 {
   char *result = (char *) -1;
-  /* We use te environment variable LD_ORIGIN_PATH.  If it is set make
+  /* We use the environment variable LD_ORIGIN_PATH.  If it is set make
      a copy and strip out trailing slashes.  */
   if (_dl_origin_path != NULL)
     {
@@ -37,7 +37,7 @@ get_origin (void)
       else
 	{
 	  char *cp = __mempcpy (result, _dl_origin_path, len);
-	  while (cp > result && cp[-1] == '/')
+	  while (cp > result + 1 && cp[-1] == '/')
 	    --cp;
 	  *cp = '\0';
 	}
diff --git a/sysdeps/unix/sysv/linux/dl-origin.h b/sysdeps/unix/sysv/linux/dl-origin.h
index f5a92379db..5654b42a2f 100644
--- a/sysdeps/unix/sysv/linux/dl-origin.h
+++ b/sysdeps/unix/sysv/linux/dl-origin.h
@@ -37,13 +37,15 @@ get_origin (void)
       result = (char *) malloc (last_slash - linkval + 1);
       if (result == NULL)
 	result = (char *) -1;
+      else if (last_slash == linkval)
+	memcpy (result, "/", 2);
       else
 	*((char *) __mempcpy (result, linkval, last_slash - linkval)) = '\0';
     }
   else
     {
       result = (char *) -1;
-      /* We use te environment variable LD_ORIGIN_PATH.  If it is set make
+      /* We use the environment variable LD_ORIGIN_PATH.  If it is set make
 	 a copy and strip out trailing slashes.  */
       if (_dl_origin_path != NULL)
 	{
@@ -54,7 +56,7 @@ get_origin (void)
 	  else
 	    {
 	      char *cp = __mempcpy (result, _dl_origin_path, len);
-	      while (cp > result && cp[-1] == '/')
+	      while (cp > result + 1 && cp[-1] == '/')
 		--cp;
 	      *cp = '\0';
 	    }