about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2010-05-03 14:04:52 -0700
committerUlrich Drepper <drepper@redhat.com>2010-05-03 14:04:52 -0700
commit7dee26605bf8627f0673f81635c38c8a565dd2b7 (patch)
tree9b888f99d4d77fc850e371d0a343a65e94517349
parentf2976023940a8ef3bbe0c7e593897e1b612370f1 (diff)
downloadglibc-7dee26605bf8627f0673f81635c38c8a565dd2b7.tar.gz
glibc-7dee26605bf8627f0673f81635c38c8a565dd2b7.tar.xz
glibc-7dee26605bf8627f0673f81635c38c8a565dd2b7.zip
Fix ldconfig to handle symlinks in chroot correctly.
-rw-r--r--ChangeLog3
-rw-r--r--elf/ldconfig.c13
2 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d332b3231d..064dbf93f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2010-05-03  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #11149]
+	* elf/ldconfig.c (search_dir): Fix handling of symlinks in chroot.
+
 	* elf/chroot_canon.c (chroot_canon): Use xmalloc and xrealloc.
 
 	* elf/ldconfig.c (parse_conf_include): Don't fall back to
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index 4b9c4350f5..00664e63c7 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -773,7 +773,18 @@ search_dir (const struct dir_entry *entry)
 	{
 	  /* In case of symlink, we check if the symlink refers to
 	     a directory. */
-	  if (__builtin_expect (stat64 (real_file_name, &stat_buf), 0))
+	  char *target_name = real_file_name;
+	  if (opt_chroot)
+	    {
+	      target_name = chroot_canon (opt_chroot, file_name);
+	      if (target_name == NULL)
+		{
+		  if (strstr (file_name, ".so") == NULL)
+		    error (0, 0, _("Input file %s not found.\n"), file_name);
+		  continue;
+		}
+	    }
+	  if (__builtin_expect (stat64 (target_name, &stat_buf), 0))
 	    {
 	      if (opt_verbose)
 		error (0, errno, _("Cannot stat %s"), file_name);