Ian Kent cc58c1
autofs-5.0.6 - check if /etc/mtab is a link to /proc/self/mounts
Ian Kent cc58c1
Ian Kent cc58c1
From: Leonardo Chiquitto <leonardo.lists@gmail.com>
Ian Kent cc58c1
Ian Kent cc58c1
Check if /etc/mtab is a link to /proc/self/mounts
Ian Kent cc58c1
Ian Kent cc58c1
Some distributions link /etc/mtab to /proc/self/mounts instead
Ian Kent cc58c1
of /proc/mounts.
Ian Kent cc58c1
---
Ian Kent cc58c1
Ian Kent cc58c1
 CHANGELOG           |    1 +
Ian Kent cc58c1
 daemon/spawn.c      |    9 ++++++---
Ian Kent cc58c1
 include/automount.h |    3 ++-
Ian Kent cc58c1
 3 files changed, 9 insertions(+), 4 deletions(-)
Ian Kent cc58c1
Ian Kent cc58c1
Ian Kent cc58c1
--- autofs-5.0.6.orig/CHANGELOG
Ian Kent cc58c1
+++ autofs-5.0.6/CHANGELOG
Ian Kent cc58c1
@@ -48,6 +48,7 @@
Ian Kent cc58c1
 - move timeout to map_source (allow per direct map timeout).
Ian Kent cc58c1
 - fix kernel verion check of version components.
Ian Kent cc58c1
 - dont retry ldap connect if not required.
Ian Kent cc58c1
+- check if /etc/mtab is a link to /proc/self/mounts.
Ian Kent cc58c1
 
Ian Kent cc58c1
 28/06/2011 autofs-5.0.6
Ian Kent cc58c1
 -----------------------
Ian Kent cc58c1
--- autofs-5.0.6.orig/daemon/spawn.c
Ian Kent cc58c1
+++ autofs-5.0.6/daemon/spawn.c
Ian Kent cc58c1
@@ -336,7 +336,8 @@ int spawn_mount(unsigned logopt, ...)
Ian Kent cc58c1
 	ret = readlink(_PATH_MOUNTED, buf, PATH_MAX);
Ian Kent cc58c1
 	if (ret != -1) {
Ian Kent cc58c1
 		buf[ret] = '\0';
Ian Kent cc58c1
-		if (!strcmp(buf, _PROC_MOUNTS)) {
Ian Kent cc58c1
+		if (!strcmp(buf, _PROC_MOUNTS) ||
Ian Kent cc58c1
+		    !strcmp(buf, _PROC_SELF_MOUNTS)) {
Ian Kent cc58c1
 			debug(logopt,
Ian Kent cc58c1
 			      "mtab link detected, passing -n to mount");
Ian Kent cc58c1
 			argc++;
Ian Kent cc58c1
@@ -467,7 +468,8 @@ int spawn_bind_mount(unsigned logopt, ..
Ian Kent cc58c1
 	ret = readlink(_PATH_MOUNTED, buf, PATH_MAX);
Ian Kent cc58c1
 	if (ret != -1) {
Ian Kent cc58c1
 		buf[ret] = '\0';
Ian Kent cc58c1
-		if (!strcmp(buf, _PROC_MOUNTS)) {
Ian Kent cc58c1
+		if (!strcmp(buf, _PROC_MOUNTS) ||
Ian Kent cc58c1
+		    !strcmp(buf, _PROC_SELF_MOUNTS)) {
Ian Kent cc58c1
 			debug(logopt,
Ian Kent cc58c1
 			      "mtab link detected, passing -n to mount");
Ian Kent cc58c1
 			argc++;
Ian Kent cc58c1
@@ -569,7 +571,8 @@ int spawn_umount(unsigned logopt, ...)
Ian Kent cc58c1
 	ret = readlink(_PATH_MOUNTED, buf, PATH_MAX);
Ian Kent cc58c1
 	if (ret != -1) {
Ian Kent cc58c1
 		buf[ret] = '\0';
Ian Kent cc58c1
-		if (!strcmp(buf, _PROC_MOUNTS)) {
Ian Kent cc58c1
+		if (!strcmp(buf, _PROC_MOUNTS) ||
Ian Kent cc58c1
+		    !strcmp(buf, _PROC_SELF_MOUNTS)) {
Ian Kent cc58c1
 			debug(logopt,
Ian Kent cc58c1
 			      "mtab link detected, passing -n to mount");
Ian Kent cc58c1
 			argc++;
Ian Kent cc58c1
--- autofs-5.0.6.orig/include/automount.h
Ian Kent cc58c1
+++ autofs-5.0.6/include/automount.h
Ian Kent cc58c1
@@ -84,7 +84,8 @@ int load_autofs4_module(void);
Ian Kent cc58c1
 #define MTAB_NOTUPDATED 0x1000			/* mtab succeded but not updated */
Ian Kent cc58c1
 #define NOT_MOUNTED     0x0100			/* path notmounted */
Ian Kent cc58c1
 #define MNT_FORCE_FAIL	-1
Ian Kent cc58c1
-#define _PROC_MOUNTS	"/proc/mounts"
Ian Kent cc58c1
+#define _PROC_MOUNTS		"/proc/mounts"
Ian Kent cc58c1
+#define _PROC_SELF_MOUNTS	"/proc/self/mounts"
Ian Kent cc58c1
 
Ian Kent cc58c1
 /* Constants for lookup modules */
Ian Kent cc58c1