summaryrefslogtreecommitdiffstats
path: root/fuse/fuse_opt.c
diff options
context:
space:
mode:
Diffstat (limited to 'fuse/fuse_opt.c')
-rw-r--r--fuse/fuse_opt.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/fuse/fuse_opt.c b/fuse/fuse_opt.c
index b15e7db11..a2118cedc 100644
--- a/fuse/fuse_opt.c
+++ b/fuse/fuse_opt.c
@@ -54,10 +54,15 @@ int fuse_opt_add_arg(struct fuse_args *args, const char *arg)
assert(!args->argv || args->allocated);
+ newarg = strdup(arg);
+ if (!newarg)
+ return alloc_failed();
+
newargv = realloc(args->argv, (args->argc + 2) * sizeof(char *));
- newarg = newargv ? strdup(arg) : NULL;
- if (!newargv || !newarg)
+ if (!newargv) {
+ free(newarg);
return alloc_failed();
+ }
args->argv = newargv;
args->allocated = 1;
@@ -304,9 +309,21 @@ static int process_real_option_group(struct fuse_opt_context *ctx, char *opts)
return -1;
d = opts;
} else {
- if (s[0] == '\\' && s[1] != '\0')
+ if (s[0] == '\\' && s[1] != '\0') {
s++;
- *d++ = *s;
+ if (s[0] >= '0' && s[0] <= '3' &&
+ s[1] >= '0' && s[1] <= '7' &&
+ s[2] >= '0' && s[2] <= '7') {
+ *d++ = (s[0] - '0') * 0100 +
+ (s[1] - '0') * 0010 +
+ (s[2] - '0');
+ s += 2;
+ } else {
+ *d++ = *s;
+ }
+ } else {
+ *d++ = *s;
+ }
}
s++;
}