about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2010-04-05 11:26:43 -0700
committerUlrich Drepper <drepper@redhat.com>2010-04-05 11:26:43 -0700
commit4bc2bcba67e870778fb9397f29435ee1b66bebf3 (patch)
tree4a02236c6b246b5a9d9d4deacb07f8f093a26649 /elf
parent247fdc8ee68cf49cd808becce56b2e923b4f776b (diff)
downloadglibc-4bc2bcba67e870778fb9397f29435ee1b66bebf3.tar.gz
glibc-4bc2bcba67e870778fb9397f29435ee1b66bebf3.tar.xz
glibc-4bc2bcba67e870778fb9397f29435ee1b66bebf3.zip
Fix aux cache handling in ldconfig with chroot.
Diffstat (limited to 'elf')
-rw-r--r--elf/ldconfig.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index efa67253f5..b9f1cc2d1b 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -1305,11 +1305,9 @@ main (int argc, char **argv)
 				  p ? (*p = '\0', cache_file) : "/");
 
       if (canon == NULL)
-	{
-	  error (EXIT_FAILURE, errno,
-		 _("Can't open cache file directory %s\n"),
-		 p ? cache_file : "/");
-	}
+	error (EXIT_FAILURE, errno,
+	       _("Can't open cache file directory %s\n"),
+	       p ? cache_file : "/");
 
       if (p)
 	++p;
@@ -1346,8 +1344,17 @@ main (int argc, char **argv)
 	add_system_dir (LIBDIR);
     }
 
+  char *aux_cache_file = _PATH_LDCONFIG_AUX_CACHE;
+  if (opt_chroot)
+    {
+      aux_cache_file = chroot_canon (opt_chroot, aux_cache_file);
+      if (aux_cache_file == NULL)
+	error (EXIT_FAILURE, errno, _("Can't open cache file %s\n"),
+	       _PATH_LDCONFIG_AUX_CACHE);
+    }
+
   if (! opt_ignore_aux_cache)
-    load_aux_cache (_PATH_LDCONFIG_AUX_CACHE);
+    load_aux_cache (aux_cache_file);
   else
     init_aux_cache ();
 
@@ -1356,7 +1363,7 @@ main (int argc, char **argv)
   if (opt_build_cache)
     {
       save_cache (cache_file);
-      save_aux_cache (_PATH_LDCONFIG_AUX_CACHE);
+      save_aux_cache (aux_cache_file);
     }
 
   return 0;