summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorajacoutot <ajacoutot@openbsd.org>2015-07-07 13:03:58 +0000
committerajacoutot <ajacoutot@openbsd.org>2015-07-07 13:03:58 +0000
commit8de1d2df4a3f8cf589d31a6c15f52dfe0eee27c6 (patch)
tree1ec1db1c99b9f73a8621fb0b6b7fcdfc55ab121e
parentDo not return internal nodes to the upper layer in rn_lookup(). (diff)
downloadwireguard-openbsd-8de1d2df4a3f8cf589d31a6c15f52dfe0eee27c6.tar.xz
wireguard-openbsd-8de1d2df4a3f8cf589d31a6c15f52dfe0eee27c6.zip
Unbreak option parsing:
fuse_opt_pase is called with an opaque void * and struct fuse_opt. If val has a positive value and off != -1, we modify the opaque void * at the offset off to put it val. This matches what the GNU libfuse does. fixes (at least) simple-mtpfs option parsing diff from slacker syl@, thanks! "it can't get worse than not working" mikeb@ ok miod@ sthen@
-rw-r--r--lib/libfuse/fuse_opt.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libfuse/fuse_opt.c b/lib/libfuse/fuse_opt.c
index 8919f11c18d..b332bfb7cc3 100644
--- a/lib/libfuse/fuse_opt.c
+++ b/lib/libfuse/fuse_opt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fuse_opt.c,v 1.12 2015/02/06 23:21:58 millert Exp $ */
+/* $OpenBSD: fuse_opt.c,v 1.13 2015/07/07 13:03:58 ajacoutot Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
* Copyright (c) 2013 Stefan Sperling <stsp@openbsd.org>
@@ -249,6 +249,13 @@ parse_opt(const struct fuse_opt *o, const char *val, void *data,
ret = f(data, val, o->val, arg);
}
+ if (o->off != ULONG_MAX && data && o->val >= 0) {
+ ret = f(data, val, o->val, arg);
+ int *addr = (int *)(data + o->off);
+ *addr = o->val;
+ ret = 0;
+ }
+
if (ret == -1)
return (ret);
if (ret == 1)