about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPetr Baudis <pasky@suse.cz>2010-11-22 12:47:57 -0500
committerAndreas Schwab <schwab@redhat.com>2010-12-01 15:35:20 +0100
commit647691a92f668eb3882ad8fd97b3766a52de61df (patch)
treee05ce86860484a2684e6e762176d73a1c9b03a60
parentd1d5508011bfbd594f4d1c61d20b0ab9fb1bdc1d (diff)
downloadglibc-647691a92f668eb3882ad8fd97b3766a52de61df.tar.gz
glibc-647691a92f668eb3882ad8fd97b3766a52de61df.tar.xz
glibc-647691a92f668eb3882ad8fd97b3766a52de61df.zip
Allow aux_cache_file open()ing to fail silently even in the chroot mode.
The aux_cache fix of bug 11149 introduced a new bug - normally,
ldconfig -r never cares if the auxiliary cache is not available and
that is not a fatal problem, however this is not the case in case
of ldconfig -r when executed as non-root. In that case, ldconfig -r
fails hard unless var/cache/ldconfig/ exists within the chroot. This
patch fixes that.

Conflicts:

	ChangeLog
(cherry picked from commit 6db52fbb272979bdcd5d5dd7ab187e1893eda9e3)
-rw-r--r--ChangeLog6
-rw-r--r--elf/ldconfig.c12
2 files changed, 10 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index de688e39e2..2744ca6631 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-05-31  Petr Baudis  <pasky@suse.cz>
+
+	[BZ #11149]
+	* elf/ldconfig.c (main): Allow aux_cache_file open()ing to fail
+	silently even in the chroot mode.
+
 2010-05-31  Petr Baudis <pasky@suse.cz>
 
 	[BZ #10085]
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index b4af31e5b5..b82ca8e308 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -1359,14 +1359,9 @@ main (int argc, char **argv)
 
   const 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);
-    }
+    aux_cache_file = chroot_canon (opt_chroot, aux_cache_file);
 
-  if (! opt_ignore_aux_cache)
+  if (! opt_ignore_aux_cache && aux_cache_file)
     load_aux_cache (aux_cache_file);
   else
     init_aux_cache ();
@@ -1376,7 +1371,8 @@ main (int argc, char **argv)
   if (opt_build_cache)
     {
       save_cache (cache_file);
-      save_aux_cache (aux_cache_file);
+      if (aux_cache_file)
+        save_aux_cache (aux_cache_file);
     }
 
   return 0;