From ad86ee6bf77fd74437c48bd41988fe8a8914d466 Mon Sep 17 00:00:00 2001 From: Chih-Wei Huang Date: Tue, 9 Apr 2019 18:25:12 +0800 Subject: [PATCH 1/1] Revert "Split mount options into FUSE- and exFAT-specific." This reverts commit 78d28968cbcb7dcb856e153774fdb4ccb38b0fcf. --- fuse/main.c | 52 +++++++++++++++++++--------------------------------- 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/fuse/main.c b/fuse/main.c index 833330c..30239e2 100644 --- a/fuse/main.c +++ b/fuse/main.c @@ -42,6 +42,9 @@ #error FUSE 2.6 or later is required #endif +const char* default_options = "ro_fallback,allow_other,blkdev,big_writes," + "default_permissions"; + struct exfat ef; static struct exfat_node* get_node(const struct fuse_file_info* fi) @@ -509,19 +512,14 @@ int main(int argc, char* argv[]) { const char* spec = NULL; char* mount_point = NULL; - char* fuse_options; - char* exfat_options; + char* mount_options; int opt; int rc; printf("FUSE exfat %s\n", VERSION); - fuse_options = strdup("allow_other," - "big_writes," - "blkdev," - "default_permissions"); - exfat_options = strdup("ro_fallback"); - if (fuse_options == NULL || exfat_options == NULL) + mount_options = strdup(default_options); + if (mount_options == NULL) { exfat_error("failed to allocate options string"); return 1; @@ -532,65 +530,53 @@ int main(int argc, char* argv[]) switch (opt) { case 'd': - fuse_options = add_option(fuse_options, "debug", NULL); - if (fuse_options == NULL) - { - free(exfat_options); + mount_options = add_option(mount_options, "debug", NULL); + if (mount_options == NULL) return 1; - } break; case 'n': break; case 'o': - exfat_options = add_option(exfat_options, optarg, NULL); - if (exfat_options == NULL) - { - free(fuse_options); + mount_options = add_option(mount_options, optarg, NULL); + if (mount_options == NULL) return 1; - } break; case 'V': - free(exfat_options); - free(fuse_options); + free(mount_options); puts("Copyright (C) 2010-2018 Andrew Nayenko"); return 0; case 'v': break; default: - free(exfat_options); - free(fuse_options); + free(mount_options); usage(argv[0]); break; } } if (argc - optind != 2) { - free(exfat_options); - free(fuse_options); + free(mount_options); usage(argv[0]); } spec = argv[optind]; mount_point = argv[optind + 1]; - if (exfat_mount(&ef, spec, exfat_options) != 0) + if (exfat_mount(&ef, spec, mount_options) != 0) { - free(exfat_options); - free(fuse_options); + free(mount_options); return 1; } - free(exfat_options); - - fuse_options = add_fuse_options(fuse_options, spec, ef.ro != 0); - if (fuse_options == NULL) + mount_options = add_fuse_options(mount_options, spec, (ef.ro != 0)); + if (mount_options == NULL) { exfat_unmount(&ef); return 1; } /* let FUSE do all its wizardry */ - rc = fuse_exfat_main(fuse_options, mount_point); + rc = fuse_exfat_main(mount_options, mount_point); - free(fuse_options); + free(mount_options); return rc; } -- 2.11.0