OSDN Git Service

android: fix parsing issue of Android 8.0
authorChih-Wei Huang <cwhuang@linux.org.tw>
Thu, 30 Nov 2017 06:23:56 +0000 (14:23 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Thu, 30 Nov 2017 06:23:56 +0000 (14:23 +0800)
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.

libfuse-lite/fuse_opt.c
libfuse-lite/fusermount.c

index 80b0777..c2f98da 100644 (file)
@@ -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';
         }
index ae46035..91dbdd0 100644 (file)
@@ -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")) {