+2008-06-27 Miklos Szeredi <miklos@szeredi.hu>
+
+ * Fix handling of (no)suid and (no)dev options if filesystem is
+ mounted from /etc/fstab or via mount(8). Reported by Jan Ondrej.
+
2008-06-16 Miklos Szeredi <miklos@szeredi.hu>
* Remove fuse kernel module sources. Linux 2.6.27 will support
*cmdp = cmd;
}
+static char *add_option(const char *opt, char *options)
+{
+ int oldlen = options ? strlen(options) : 0;
+
+ options = xrealloc(options, oldlen + 1 + strlen(opt) + 1);
+ if (!oldlen)
+ strcpy(options, opt);
+ else {
+ strcat(options, ",");
+ strcat(options, opt);
+ }
+ return options;
+}
+
int main(int argc, char *argv[])
{
char *type = NULL;
char *command = NULL;
char *setuid = NULL;
int i;
+ int dev = 1;
+ int suid = 1;
progname = argv[0];
basename = strrchr(argv[0], '/');
ignore = 1;
if (!ignore) {
- int oldlen =
- options ? strlen(options) : 0;
- options = xrealloc(options, oldlen + 1 + strlen(opt) + 1);
- if (!oldlen)
- strcpy(options, opt);
- else {
- strcat(options, ",");
- strcat(options, opt);
- }
+ if (strcmp(opt, "nodev") == 0)
+ dev = 0;
+ else if (strcmp(opt, "nosuid") == 0)
+ suid = 0;
+
+ options = add_option(opt, options);
}
opt = strtok(NULL, ",");
}
}
}
+ if (dev)
+ options = add_option("dev", options);
+ if (suid)
+ options = add_option("suid", options);
+
if (!type) {
type = xstrdup(source);
source = strchr(type, '#');