diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2008-07-10 19:30:43 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2008-07-10 19:30:43 +0000 |
commit | cb71b4372c963da8c9fef37eac3ddb60de02b2a3 (patch) | |
tree | 876518822fc76f6849726b7a7d646d9e56b0fd6f /util | |
parent | 4bfbd81047cd7db13af86687e53fddb147278189 (diff) |
Fix handling of (no)suid and (no)dev options...
Diffstat (limited to 'util')
-rw-r--r-- | util/mount.fuse.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/util/mount.fuse.c b/util/mount.fuse.c index 7bd0e83..b388f9e 100644 --- a/util/mount.fuse.c +++ b/util/mount.fuse.c @@ -59,6 +59,20 @@ static void add_arg(char **cmdp, const char *opt) *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; @@ -69,6 +83,8 @@ int main(int argc, char *argv[]) char *command = NULL; char *setuid = NULL; int i; + int dev = 1; + int suid = 1; progname = argv[0]; basename = strrchr(argv[0], '/'); @@ -151,21 +167,23 @@ int main(int argc, char *argv[]) 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, '#'); |