package/ntfs3-mount: check NTFS signature

Signed-off-by: Liangbin Lian <jjm2473@gmail.com>
This commit is contained in:
Liangbin Lian 2025-12-02 20:13:11 +08:00
parent be12783ed2
commit 7da4916fef
2 changed files with 8 additions and 1 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ntfs3-mount
PKG_RELEASE:=7
PKG_RELEASE:=8
include $(INCLUDE_DIR)/package.mk

View File

@ -1,2 +1,9 @@
#!/bin/sh
if [[ "$1" != "-*" ]]; then
head -c 11 "$1" | tail -c 8 | grep -Fwq 'NTFS ' || {
echo "NTFS signature is missing." >&2
exit 32
}
fi
mount -i -t ntfs3 -o iocharset=utf8,force "$@" || mount -i -t ntfs3 -o iocharset=utf8,ro "$@"