[OpenWrt-Devel] [PATCH, V2] fstools: mount ntfs with ntfs-3g utility if it exist

Rosy Song rosysong at rosinson.com
Sun Sep 30 23:04:13 EDT 2018


Signed-off-by: Rosy Song <rosysong at rosinson.com>
---
 block.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/block.c b/block.c
index 2651c86..b2cd32b 100644
--- a/block.c
+++ b/block.c
@@ -881,7 +881,13 @@ static int handle_mount(const char *source, const char *target,
 	size_t mount_opts_len;
 	char *mount_opts = NULL, *ptr;
 
-	err = mount(source, target, fstype, m ? m->flags : 0,
+	/* Mount ntfs filesystem with ntfs-3g utility */
+	if (!strcmp(fstype, "ntfs") &&
+	    !access("/sbin/mount.ntfs-3g", X_OK)) {
+	    err = -1;
+	    errno = ENODEV;
+	} else
+	    err = mount(source, target, fstype, m ? m->flags : 0,
 	            (m && m->options) ? m->options : "");
 
 	/* Requested file system type is not available in kernel,
-- 
2.17.0


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list