1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
Description: Recognize fuse options placed before the arguments
The original source requires one to place any fuse option after the arguments
(ISO image and mount point). This patch allows one to also place them before
the arguments following the usual program-options-arguments scheme.
Forwarded: not-needed
Bug-Debian: https://bugs.debian.org/1083034
Author: =?utf-8?b?0L3QsNCx?= <nabijaczleweli@nabijaczleweli.xyz>
Reviewed-by: Sven Geuer <sge@debian.org>
Author: Sven Geuer <sge@debian.org>
Last-Update: 2024-10-28
--- a/src/fuseiso.c
+++ b/src/fuseiso.c
@@ -293,9 +293,11 @@
" -c <iocharset> -- specify iocharset for Joliet filesystem\n"
" -h -- print this screen\n"
"\nCommon FUSE library options are:\n"
+ " -o <opts> -- specify comma-separated list of mount options\n"
+ " -s -- run single-threaded\n"
" -f -- run in foreground, do not daemonize\n"
" -d -- run in foreground and print debug information\n"
- " -s -- run single-threaded\n"
+ " -V -- print libfuse version information\n"
"\nPlease consult with FUSE documentation for more information\n",
VERSION,
prog);
@@ -309,9 +311,14 @@
maintain_mount_point = 0;
maintain_mtab = 1;
iocharset = NULL;
+
+ char **fuseopts = reallocarray(NULL, 1, sizeof(*fuseopts));
+ fuseopts[0] = argv[0];
+ size_t fuseopts_cnt = 1;
int c;
- while((c = getopt(argc, argv, "+npc:h")) > 0) {
+ char *s;
+ while((c = getopt(argc, argv, "+npc:ho:sfdV")) > 0) {
switch((char)c) {
case 'n':
maintain_mtab = 0;
@@ -328,6 +335,24 @@
usage(argv[0]);
exit(0);
break;
+ case 'o':
+ fuseopts = reallocarray(fuseopts, fuseopts_cnt + 2, sizeof(*fuseopts));
+ fuseopts[fuseopts_cnt++] = "-o";
+ fuseopts[fuseopts_cnt++] = optarg;
+ break;
+ case 's':
+ case 'f':
+ case 'd':
+ fuseopts = reallocarray(fuseopts, fuseopts_cnt + 1, sizeof(*fuseopts));
+ s = (char *)malloc(3);
+ snprintf(s, 3, "-%c", c);
+ fuseopts[fuseopts_cnt++] = s;
+ break;
+ case 'V':
+ fuseopts = reallocarray(fuseopts, fuseopts_cnt + 1, sizeof(*fuseopts));
+ fuseopts[fuseopts_cnt++] = "-V";
+ return fuse_main(fuseopts_cnt, fuseopts, &isofs_oper, NULL);
+ break;
case '?':
case ':':
usage(argv[0]);
@@ -352,14 +377,10 @@
mount_point = normalize_name(argv[optind]);
- int nargc = 1 + argc - optind;
- char **nargv = (char **) malloc((nargc) * sizeof(char *));
-
- nargv[0] = argv[0];
+ fuseopts = reallocarray(fuseopts, fuseopts_cnt + argc - optind, sizeof(*fuseopts));
- int i;
- for(i = 0; i < nargc - 1; ++i) {
- nargv[i + 1] = argv[optind + i];
+ while(optind < argc) {
+ fuseopts[fuseopts_cnt++] = argv[optind++];
};
if(!iocharset) {
@@ -392,5 +413,5 @@
// will exit in case of failure
rc = isofs_real_preinit(imagefile, image_fd);
- return fuse_main(nargc, nargv, &isofs_oper, NULL);
+ return fuse_main(fuseopts_cnt, fuseopts, &isofs_oper, NULL);
};
|