From 863ef36011144a8907359bddc3fe705e5185fd1b Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Sat, 23 Jul 2011 18:25:55 -0500 Subject: [PATCH] mtab: fix test for a link to a location in /proc /etc/mtab can be a link to a file in /proc. If it is, we should not attempt to update /etc/mtab. The original test used "! -w" as part of the test. This does not work since everything is writeable by root. Thanks to Robin Johnson for the suggestion of using readlink -f and the regular expression. Reported-By: junkmailnotread@yahoo.com X-Gentoo-Bug: 370037 X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=370037 --- init.d/mtab.in | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/init.d/mtab.in b/init.d/mtab.in index e741bc1c..23a5e7d9 100644 --- a/init.d/mtab.in +++ b/init.d/mtab.in @@ -12,9 +12,10 @@ depend() start() { - # /etc/mtab could be a symlink to /proc/mounts - if [ ! -w /etc/mtab -a -L /etc/mtab ]; then - einfo "Skipping mtab update (non writeable symlink)" + # /etc/mtab could be a symlink to a location in /proc + if readlink -f /etc/mtab | grep -sq '^/proc/\(self\|[0-9]\+\)/mounts$' + then + einfo "Skipping mtab update (link points to location in /proc)" return 0 fi