From 1a42cdf90493502deb78193dc2e81d5b2f1816ce Mon Sep 17 00:00:00 2001
From: William Hubbs <williamh@gentoo.org>
Date: Sat, 23 Jul 2011 18:25:55 -0500
Subject: [PATCH] mtab: fix test for /proc/mounts

The symbolic link /etc/mtab can be a link to /proc/mounts. If it is,
this script should abort and 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.

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 |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/init.d/mtab.in b/init.d/mtab.in
index e741bc1..2667555 100644
--- a/init.d/mtab.in
+++ b/init.d/mtab.in
@@ -13,8 +13,8 @@ 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)"
+	if [ -L /etc/mtab -a "$(readlink /etc/mtab)" = "/proc/mounts" ]; then
+		einfo "Skipping mtab update (symlink points to /proc/mounts)"
 		return 0
 	fi
 
-- 
1.7.3.4