[PATCH] Check if /etc/mtab is a link to /proc/self/mounts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Ian,

Please, could you consider this patch for inclusion?

Thanks,
Leonardo

Check if /etc/mtab is a link to /proc/self/mounts

Some distributions link /etc/mtab to /proc/self/mounts instead
of /proc/mounts.

diff --git a/CHANGELOG b/CHANGELOG
index bbd3156..2e08ffa 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -52,6 +52,7 @@
 - dont retry ldap connect if not required.
 - fix initialization in rpc create_client().
 - fix libtirpc name clash.
+- check if /etc/mtab is a link to /proc/self/mounts.

 28/06/2011 autofs-5.0.6
 -----------------------
diff --git a/daemon/spawn.c b/daemon/spawn.c
index 285f4d7..3b4a009 100644
--- a/daemon/spawn.c
+++ b/daemon/spawn.c
@@ -336,7 +336,8 @@ int spawn_mount(unsigned logopt, ...)
 	ret = readlink(_PATH_MOUNTED, buf, PATH_MAX);
 	if (ret != -1) {
 		buf[ret] = '\0';
-		if (!strcmp(buf, _PROC_MOUNTS)) {
+		if (!strcmp(buf, _PROC_MOUNTS) ||
+		    !strcmp(buf, _PROC_SELF_MOUNTS)) {
 			debug(logopt,
 			      "mtab link detected, passing -n to mount");
 			argc++;
@@ -467,7 +468,8 @@ int spawn_bind_mount(unsigned logopt, ...)
 	ret = readlink(_PATH_MOUNTED, buf, PATH_MAX);
 	if (ret != -1) {
 		buf[ret] = '\0';
-		if (!strcmp(buf, _PROC_MOUNTS)) {
+		if (!strcmp(buf, _PROC_MOUNTS) ||
+		    !strcmp(buf, _PROC_SELF_MOUNTS)) {
 			debug(logopt,
 			      "mtab link detected, passing -n to mount");
 			argc++;
@@ -569,7 +571,8 @@ int spawn_umount(unsigned logopt, ...)
 	ret = readlink(_PATH_MOUNTED, buf, PATH_MAX);
 	if (ret != -1) {
 		buf[ret] = '\0';
-		if (!strcmp(buf, _PROC_MOUNTS)) {
+		if (!strcmp(buf, _PROC_MOUNTS) ||
+		    !strcmp(buf, _PROC_SELF_MOUNTS)) {
 			debug(logopt,
 			      "mtab link detected, passing -n to mount");
 			argc++;
diff --git a/include/automount.h b/include/automount.h
index 589ea1f..3146934 100644
--- a/include/automount.h
+++ b/include/automount.h
@@ -85,6 +85,7 @@ int load_autofs4_module(void);
 #define NOT_MOUNTED     0x0100			/* path notmounted */
 #define MNT_FORCE_FAIL	-1
 #define _PROC_MOUNTS	"/proc/mounts"
+#define _PROC_SELF_MOUNTS	"/proc/self/mounts"

 /* Constants for lookup modules */
--
To unsubscribe from this list: send the line "unsubscribe autofs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux