-/* $OpenBSD: fuse_opt.c,v 1.22 2017/12/11 12:38:54 helg Exp $ */
+/* $OpenBSD: fuse_opt.c,v 1.23 2017/12/13 12:23:48 helg Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
* Copyright (c) 2013 Stefan Sperling <stsp@openbsd.org>
int keyval, ret, found;
size_t sep;
- if (o == NULL)
- return (IFUSE_OPT_KEEP);
-
keyval = 0;
found = 0;
- for(; o->templ; o++) {
+ for(; o != NULL && o->templ; o++) {
sep = match_opt(o->templ, opt);
if (sep == 0)
continue;
int cache;
int set_gid;
int gid;
+ int bad_opt;
};
enum {
return (1);
}
+ if (strcmp("bad_opt", arg) == 0) {
+ conf->bad_opt = 1;
+ return (0);
+ }
+
return (1);
}
assert(data.ssh_ver == 0);
assert(data.count == 0);
assert(data.cache == 0);
+ assert(data.bad_opt == 0);
}
/*
char *argv_null_opts[] = {
"progname",
- "/mnt"
+ "/mnt",
+ "bad_opt"
};
args.argc = sizeof(argv_null_opts) / sizeof(argv_null_opts[0]);
assert(data.cache == 0);
assert(data.set_gid == 0);
assert(data.gid == 0);
+ assert(data.bad_opt == 1);
assert(args.argc == 2);
assert(strcmp(args.argv[0], "progname") == 0);
"-x", "xanadu",
"-o", "optstring=",
"-o", "optstring=optstring",
- "--count=10"
+ "--count=10",
+ "bad_opt"
};
args.argc = sizeof(argv_null_proc) / sizeof(argv_null_proc[0]);
assert(data.cache == 0);
assert(data.set_gid == 1);
assert(data.gid == 077);
+ assert(data.bad_opt == 0);
- assert(args.argc == 8);
+ assert(args.argc == 9);
assert(strcmp(args.argv[0], "progname") == 0);
assert(strcmp(args.argv[1], "-o") == 0);
assert(strcmp(args.argv[2], "debug") == 0);
assert(strcmp(args.argv[5], "-d") == 0);
assert(strcmp(args.argv[6], "-p22") == 0);
assert(strcmp(args.argv[7], "/mnt") == 0);
+ assert(strcmp(args.argv[8], "bad_opt") == 0);
assert(args.allocated);
fuse_opt_free_args(&args);
"-1",
"-x", "xanadu",
"-o", "optstring=optstring,cache=no",
- "--count=10"
+ "--count=10",
+ "bad_opt"
};
args.argc = sizeof(argv) / sizeof(argv[0]);
assert(data.cache == 0);
assert(data.set_gid == 1);
assert(data.gid == 077);
+ assert(data.bad_opt == 1);
assert(args.argc == 7);
assert(strcmp(args.argv[0], "progname") == 0);