From: Chih-Wei Huang Date: Thu, 30 Nov 2017 06:23:56 +0000 (+0800) Subject: android: fix parsing issue of Android 8.0 X-Git-Tag: android-x86-8.1-r1~1 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=dfe2bc1a2e4d37f88993ff3f72cdc1a5a8e766e2;p=android-x86%2Fexternal-ntfs-3g.git android: fix parsing issue of Android 8.0 Android 8.0 stupidly uses comma in vold's device node name, say "/dev/block/vold/public:8,32". The libfuse-lite can't parse it correctly since a comma is usually used as a separator between options. Modify the options parser to handle it specially. --- diff --git a/libfuse-lite/fuse_opt.c b/libfuse-lite/fuse_opt.c index 80b07774..c2f98da1 100644 --- a/libfuse-lite/fuse_opt.c +++ b/libfuse-lite/fuse_opt.c @@ -278,6 +278,15 @@ static int process_real_option_group(struct fuse_opt_context *ctx, char *opts) #endif /* __SOLARIS__ */ { sep = strchr(opts, ','); +#ifdef ANDROID + if (!strncmp(opts, "fsname=/dev/block/vold/public:", 30)) { + if (sep && *(sep - 1) == '\\') { + sep--; + memmove(sep, sep + 1, strlen(sep)); + } + sep = strchr(sep + 1, ','); + } +#endif if (sep) *sep = '\0'; } diff --git a/libfuse-lite/fusermount.c b/libfuse-lite/fusermount.c index ae46035d..91dbdd02 100644 --- a/libfuse-lite/fusermount.c +++ b/libfuse-lite/fusermount.c @@ -361,6 +361,10 @@ static int do_mount(const char *mnt, char **typep, mode_t rootmode, const char *fsname_str = "fsname="; for (len = 0; s[len] && s[len] != ','; len++); if (begins_with(s, fsname_str)) { +#ifdef ANDROID + if (begins_with(s + 7, "/dev/block/vold/public:")) + for (len++; s[len] && s[len] != ','; len++); +#endif if (!get_string_opt(s, len, fsname_str, &fsname)) goto err; } else if (opt_eq(s, len, "blkdev")) {