a8b5679
diff -rNup a/fedora/glibc_post_upgrade.c b/fedora/glibc_post_upgrade.c
a8b5679
--- a/fedora/glibc_post_upgrade.c	2011-10-19 05:04:41.000000000 -0600
a8b5679
+++ b/fedora/glibc_post_upgrade.c	2012-02-06 11:02:03.236713830 -0700
a8b5679
@@ -60,6 +60,7 @@ is_ia64 (void)
a8b5679
 int
a8b5679
 main (void)
a8b5679
 {
a8b5679
+  struct stat statbuf;
a8b5679
   char initpath[256];
a8b5679
 
a8b5679
   char buffer[4096];
a8b5679
@@ -170,12 +171,24 @@ main (void)
a8b5679
       || ((!!access ("/dev/initctl", F_OK))
a8b5679
 	  ^ !access ("/sbin/initctl", X_OK)))
a8b5679
     _exit (0);
a8b5679
+
a8b5679
   /* Check if we are not inside of some chroot, because we'd just
a8b5679
-     timeout and leave /etc/initrunlvl.  */
a8b5679
+     timeout and leave /etc/initrunlvl. 
a8b5679
+
a8b5679
+     On more modern systems this test is not sufficient to detect
a8b5679
+     if we're in a chroot.  */
a8b5679
   if (readlink ("/proc/1/exe", initpath, 256) <= 0 ||
a8b5679
       readlink ("/proc/1/root", initpath, 256) <= 0)
a8b5679
     _exit (0);
a8b5679
 
a8b5679
+  /* Here's another well known way to detect chroot, at least on an
a8b5679
+     ext and xfs filesystems and assuming nothing mounted on the chroot's
a8b5679
+     root. */
a8b5679
+  if (stat ("/", &statbuf) != 0
a8b5679
+      || (statbuf.st_ino != 2
a8b5679
+	  && statbuf.st_ino != 128))
a8b5679
+    _exit (0);
a8b5679
+
a8b5679
   if (check_elf ("/proc/1/exe"))
a8b5679
     verbose_exec (116, "/sbin/telinit", "/sbin/telinit", "u");
a8b5679