From 33f5c70e6c8781758d2bfde0f60ca3d6ec7d543f Mon Sep 17 00:00:00 2001 From: Far Date: Mon, 12 Jul 2021 21:05:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DFATFS=E4=B8=AD?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E5=86=85=E9=83=A8=E6=8E=A5=E5=8F=A3=E4=B8=8D?= =?UTF-8?q?=E6=94=AF=E6=8C=81FAT12/FAT16=20FAT=E8=A1=A8=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E6=A0=87=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FATFS内部接口中,仅对FAT32的FAT表结束符0x0FFFFFFF做了判断,而忽略了FAT12和FAT16的结束标志。 这会导致子在FAT12/FAT16中,部分功能异常。 Close #I409R6 Signed-off-by: Far --- fs/fat/os_adapt/fatfs.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/fat/os_adapt/fatfs.c b/fs/fat/os_adapt/fatfs.c index 0330388e..1876af94 100644 --- a/fs/fat/os_adapt/fatfs.c +++ b/fs/fat/os_adapt/fatfs.c @@ -904,11 +904,13 @@ int fatfs_fallocate64(struct file *filep, int mode, off64_t offset, off64_t len) return -EBUSY; } result = f_expand(fp, (FSIZE_t)offset, (FSIZE_t)len, 1); - if (result == FR_OK && finfo->sclst == 0) { - finfo->sclst = fp->obj.sclust; + if (result == FR_OK) { + if (finfo->sclst == 0) { + finfo->sclst = fp->obj.sclust; + } + result = f_sync(fp); } - result = f_sync(fp); - unlock_fs(fs, FR_OK); + unlock_fs(fs, result); return -fatfs_2_vfs(result); } -- GitLab