Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 130701790bf2d95e902edf16031ff596 > files > 175

autofs-5.0.1-0.rc2.164.el5_8.src.rpm

diff --git a/CHANGELOG b/CHANGELOG
index 2c8b427..ccac516 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -35,6 +35,7 @@
 - fix multiply recursive bind mounts.
 - check kernel module version and require 5.00 or above.
 - fix expire regression introduced in the "mitigate manual umount" patch.
+- still more on multiply recursive bind mounts.
 
 1/9/2006 autofs-5.0.1 rc2
 -------------------------
diff --git a/daemon/spawn.c b/daemon/spawn.c
index 7510b96..579c870 100644
--- a/daemon/spawn.c
+++ b/daemon/spawn.c
@@ -32,7 +32,7 @@ static pthread_mutex_t spawn_mutex = PTH
 
 #define SPAWN_OPT_NONE		0x0000
 #define SPAWN_OPT_LOCK		0x0001
-#define SPAWN_OPT_OPENDIR	0x0002
+#define SPAWN_OPT_ACCESS	0x0002
 
 inline void dump_core(void)
 {
@@ -94,7 +94,7 @@ static int do_spawn(logger *log, unsigne
 	int errp, errn;
 	int cancel_state;
 	unsigned int use_lock = options & SPAWN_OPT_LOCK;
-	unsigned int use_opendir = options & SPAWN_OPT_OPENDIR;
+	unsigned int use_access = options & SPAWN_OPT_ACCESS;
 	sigset_t allsigs, tmpsig, oldsig;
 	struct thread_stdenv_vars *tsv;
 	pid_t euid = 0;
@@ -129,7 +129,7 @@ static int do_spawn(logger *log, unsigne
 		close(pipefd[1]);
 
 		/* Bind mount - check target exists */
-		if (use_opendir) {
+		if (use_access) {
 			char **pargv = (char **) argv;
 			int argc = 0;
 			pid_t pgrp = getpgrp();
@@ -151,9 +151,8 @@ static int do_spawn(logger *log, unsigne
 			setpgrp();
 
 			/* Trigger the recursive mount */
-			if ((dfd = opendir(argv[argc])) == NULL)
+			if (access(argv[argc], F_OK) == -1)
 				_exit(errno);
-			closedir(dfd);
 
 			seteuid(0);
 			setegid(0);
@@ -296,7 +295,7 @@ #endif
 
 /*
  * For bind mounts that depend on the target being mounted (possibly
- * itself an automount) we attempt to mount the target using an opendir
+ * itself an automount) we attempt to mount the target using an access
  * call. For this to work the location must be the second last arg.
  *
  * NOTE: If mount locking is enabled this type of recursive mount cannot
@@ -316,7 +315,7 @@ int spawn_bind_mount(logger *log, ...)
 #ifdef ENABLE_MOUNT_LOCKING
 	options = SPAWN_OPT_LOCK;
 #else
-	options = SPAWN_OPT_OPENDIR;
+	options = SPAWN_OPT_ACCESS;
 #endif
 
 	va_start(arg, log);