summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <williamh@gentoo.org>2011-07-23 18:25:55 -0500
committerWilliam Hubbs <williamh@gentoo.org>2011-07-26 00:45:22 -0500
commit863ef36011144a8907359bddc3fe705e5185fd1b (patch)
tree62a941743701b773cc068927a3b4d1d99b98806d
parent05c2d68192b80ec6177a01db6fe96fbaaf1b813f (diff)
downloadopenrc-863ef36011144a8907359bddc3fe705e5185fd1b.tar.gz
openrc-863ef36011144a8907359bddc3fe705e5185fd1b.tar.bz2
openrc-863ef36011144a8907359bddc3fe705e5185fd1b.tar.xz
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
-rw-r--r--init.d/mtab.in7
1 files changed, 4 insertions, 3 deletions
diff --git a/init.d/mtab.in b/init.d/mtab.in
index e741bc1..23a5e7d 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