]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix ldconfig to handle symlinks in chroot correctly.
authorUlrich Drepper <drepper@redhat.com>
Mon, 3 May 2010 21:04:52 +0000 (14:04 -0700)
committerPetr Baudis <pasky@ucw.cz>
Wed, 12 May 2010 01:21:22 +0000 (03:21 +0200)
(cherry picked from commit 7dee26605bf8627f0673f81635c38c8a565dd2b7)

ChangeLog
elf/ldconfig.c

index 99638b6ee94d5196103cd3bd34a98f82797962eb..373742c428132c9deeb92f6e8eb2662c3362040a 100644 (file)
--- 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
index 0d07a6075ae72c8c57af158f188d11197ae4ce3b..da77d80de6c39f87219e1c39536b74ee4d225c28 100644 (file)
@@ -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);