Re: Should mount --bind not follow symlinks?

Anthony (anthony@magix.com.sg)
Mon, 26 Mar 2001 23:04:55 +0900


Jamie Lokier wrote:
> The automounter could indeed chase those symlinks.
>
> Also, if the automounter creates a symlink in /opt anyway, and the link
> subsequently works (as you said), then it shouldn't be returning "No
> such file or directory" the first time.
>
> In other words the latter behaviour looks like a bug in the automounter,
> and the former is a feature which could be added but isn't needed for
> your application.

Okay! Well, the following I think fixes everything for me, as a
small tweak to autofs-4.0.0pre9.

Thanks

Anthony

*** modules/mount_bind.c.Orig Sun Mar 25 15:43:27 2001
--- modules/mount_bind.c Mon Mar 26 22:57:10 2001
***************
*** 19,24 ****
--- 19,25 ----
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
+ #include <stdlib.h>
#include <syslog.h>
#include <string.h>
#include <sys/param.h>
***************
*** 71,76 ****
--- 72,84 ----
char *fullpath;
int err;
int i;
+
+ char real[PATH_MAX];
+ if (!realpath(what, real)) {
+ syslog(LOG_NOTICE, MODPREFIX "realpath %s failed: %m", what);
+ return 1;
+ }
+ what = real;

fullpath = alloca(strlen(root)+name_len+2);
if ( !fullpath ) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/