OSDN Git Service

Add fsname option (required for automounting).
authorrelan <relan@users.noreply.github.com>
Tue, 13 Apr 2010 17:48:06 +0000 (17:48 +0000)
committerrelan <relan@users.noreply.github.com>
Mon, 24 Aug 2015 05:26:12 +0000 (08:26 +0300)
fuse/main.c

index 183b8ac..0a6901f 100644 (file)
@@ -305,6 +305,19 @@ static char* add_option(char* options, const char* name, const char* value)
        return options;
 }
 
+static char* add_fsname_option(char* options, const char* spec)
+{
+       char spec_abs[PATH_MAX];
+
+       if (realpath(spec, spec_abs) == NULL)
+       {
+               free(options);
+               exfat_error("failed to get absolute path for `%s'", spec);
+               return NULL;
+       }
+       return add_option(options, "fsname", spec_abs);
+}
+
 int main(int argc, char* argv[])
 {
        struct fuse_args mount_args = FUSE_ARGS_INIT(0, NULL);
@@ -355,6 +368,9 @@ int main(int argc, char* argv[])
                free(mount_options);
                usage(argv[0]);
        }
+       mount_options = add_fsname_option(mount_options, spec);
+       if (mount_options == NULL)
+               return 1;
 
        /* create arguments for fuse_mount() */
        if (fuse_opt_add_arg(&mount_args, "exfat") != 0 ||