autofs-5.0.6 - check if /etc/mtab is a link to /proc/self/mounts From: Leonardo Chiquitto Check if /etc/mtab is a link to /proc/self/mounts Some distributions link /etc/mtab to /proc/self/mounts instead of /proc/mounts. --- CHANGELOG | 1 + daemon/spawn.c | 9 ++++++--- include/automount.h | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) 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..e1246e3 100644 --- a/include/automount.h +++ b/include/automount.h @@ -84,7 +84,8 @@ int load_autofs4_module(void); #define MTAB_NOTUPDATED 0x1000 /* mtab succeded but not updated */ #define NOT_MOUNTED 0x0100 /* path notmounted */ #define MNT_FORCE_FAIL -1 -#define _PROC_MOUNTS "/proc/mounts" +#define _PROC_MOUNTS "/proc/mounts" +#define _PROC_SELF_MOUNTS "/proc/self/mounts" /* Constants for lookup modules */