about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-08-29 01:44:27 +0000
committerUlrich Drepper <drepper@redhat.com>2006-08-29 01:44:27 +0000
commit950398e1320255572f4228db94344dcd5f613455 (patch)
treee7aad239a0d2810fbd4aa70930b2e6fe94e97a47
parent4004a0a552ec2257d69d7bc1e1b6df7ad83c627d (diff)
downloadglibc-950398e1320255572f4228db94344dcd5f613455.tar.gz
glibc-950398e1320255572f4228db94344dcd5f613455.tar.xz
glibc-950398e1320255572f4228db94344dcd5f613455.zip
* elf/dl-load.c (_dl_init_paths): Expand DSTs.
-rw-r--r--ChangeLog2
-rw-r--r--elf/dl-load.c20
2 files changed, 21 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2116676637..5b771b341d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2006-08-28  Ulrich Drepper  <drepper@redhat.com>
 
+	* elf/dl-load.c (_dl_init_paths): Expand DSTs.
+
 	* elf/dl-open.c (dl_open_worker): Allow $LIB and $PLATFORM in
 	dlopen parameters.
 
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 902ffc4109..36dc123c01 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -749,7 +749,25 @@ _dl_init_paths (const char *llp)
     {
       size_t nllp;
       const char *cp = llp;
-      char *llp_tmp = strdupa (llp);
+      char *llp_tmp;
+
+#ifdef SHARED
+      /* Expand DSTs.  */
+      size_t cnt = DL_DST_COUNT (llp, 1);
+      if (__builtin_expect (cnt == 0, 1))
+	llp_tmp = strdupa (llp);
+      else
+	{
+	  /* Determine the length of the substituted string.  */
+	  size_t total = DL_DST_REQUIRED (l, llp, strlen (llp), cnt);
+
+	  /* Allocate the necessary memory.  */
+	  llp_tmp = (char *) alloca (total + 1);
+	  llp_tmp = _dl_dst_substitute (l, llp, llp_tmp, 1);
+	}
+#else
+      llp_tmp = strdupa (llp);
+#endif
 
       /* Decompose the LD_LIBRARY_PATH contents.  First determine how many
 	 elements it has.  */