Commit f698edb0 authored by Kaarle Ritvanen's avatar Kaarle Ritvanen
Browse files

community/fuse-exfat: fix automatic mounting

apply argument order patch
move helper to /sbin
parent 75c0bf00
From 49f3e46bb8b2f23b3267a70318605adf50b5903f Mon Sep 17 00:00:00 2001
From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Date: Sat, 29 Sep 2018 16:54:33 +0300
Subject: [PATCH] allow command line argument order used by mount(8)
The mount spec and directory are passed as the first and second
arguments to the helper, followed by the options.
The current implementation works on glibc but fails on POSIX-conforming
C libraries such as musl.
---
fuse/main.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/fuse/main.c b/fuse/main.c
index c645390..50b6787 100644
--- a/fuse/main.c
+++ b/fuse/main.c
@@ -512,9 +512,17 @@ static int fuse_exfat_main(char* mount_options, char* mount_point)
&fuse_exfat_ops, NULL);
}
+static void read_arg(char **param, int *argc, char ***argv) {
+ if (!*param && *argc > optind && (*argv)[optind][0] != '-') {
+ *param = (*argv)[optind];
+ ((*argv)++)[1] = (*argv)[0];
+ (*argc)--;
+ }
+}
+
int main(int argc, char* argv[])
{
- const char* spec = NULL;
+ char* spec = NULL;
char* mount_point = NULL;
char* fuse_options;
char* exfat_options;
@@ -523,6 +531,9 @@ int main(int argc, char* argv[])
printf("FUSE exfat %s\n", VERSION);
+ read_arg(&spec, &argc, &argv);
+ read_arg(&mount_point, &argc, &argv);
+
fuse_options = strdup("allow_other,"
#if defined(__linux__) || defined(__FreeBSD__)
"big_writes,"
@@ -573,15 +584,16 @@ int main(int argc, char* argv[])
usage(argv[0]);
break;
}
+
+ read_arg(&spec, &argc, &argv);
+ read_arg(&mount_point, &argc, &argv);
}
- if (argc - optind != 2)
+ if (!mount_point || argc > optind)
{
free(exfat_options);
free(fuse_options);
usage(argv[0]);
}
- spec = argv[optind];
- mount_point = argv[optind + 1];
if (exfat_mount(&ef, spec, exfat_options) != 0)
{
--
2.14.4
......@@ -3,7 +3,7 @@
pkgname=fuse-exfat
_pkgreal=exfat
pkgver=1.3.0
pkgrel=0
pkgrel=1
pkgdesc="Free exFAT file system implementation"
url="https://github.com/relan/exfat"
arch="all"
......@@ -13,13 +13,15 @@ provides="$_pkgreal"
depends="fuse"
makedepends="autoconf automake fuse-dev"
subpackages="$pkgname-doc $pkgname-utils"
source="$_pkgreal-$pkgver.tar.gz::https://github.com/relan/$_pkgreal/archive/v$pkgver.tar.gz"
source="$_pkgreal-$pkgver.tar.gz::https://github.com/relan/$_pkgreal/archive/v$pkgver.tar.gz
0001-allow-command-line-argument-order-used-by-mount-8.patch
"
builddir="$srcdir/$_pkgreal-$pkgver"
build() {
cd "$builddir"
autoreconf --install
./configure --prefix=/usr
./configure --prefix=/usr --sbindir=/sbin
make
}
......@@ -31,10 +33,11 @@ package() {
utils() {
pkgdesc="$pkgdesc (utilities)"
provides="$_pkgreal-utils"
mkdir -p "$subpkgdir"/usr/sbin
local file; for file in $(find "$pkgdir"/usr/sbin ! -name "mount*" -a ! -type d); do
mkdir -p "$subpkgdir"/sbin
local file; for file in $(find "$pkgdir"/sbin ! -name "mount*" -a ! -type d); do
mv $file "$subpkgdir"/${file#$pkgdir}
done
}
sha512sums="fa3951e16889db65685e1fb71b0c75fc7014a8025c3442bf6164b94ddd51d282a8ae5e891c46195be53d2a10d62444e2fa1bb3fa3de59c2c3411c6dac363b488 exfat-1.3.0.tar.gz"
sha512sums="fa3951e16889db65685e1fb71b0c75fc7014a8025c3442bf6164b94ddd51d282a8ae5e891c46195be53d2a10d62444e2fa1bb3fa3de59c2c3411c6dac363b488 exfat-1.3.0.tar.gz
1c3d61310f6a2f7b126d57825f7eee7acde46f809bb2f1eb9857b35c831b9499a4d63c39a76c4d67f85e8541565e6dafb7321fbe0cbe4af6d4fa6eb9f1c00dd1 0001-allow-command-line-argument-order-used-by-mount-8.patch"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment