Skip to content

Commit c0a25a6

Browse files
committed
extmod/modos: Only sync FAT filesystems using disk_ioctl.
Eventually this needs to be made a generic call to the underlying VFS. But for now this prevents `disk_ioctl()` crashing on non-FAT filesystems. Signed-off-by: Damien George <[email protected]>
1 parent fbf8114 commit c0a25a6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

extmod/modos.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@
7676
static mp_obj_t mp_os_sync(void) {
7777
#if MICROPY_VFS_FAT
7878
for (mp_vfs_mount_t *vfs = MP_STATE_VM(vfs_mount_table); vfs != NULL; vfs = vfs->next) {
79-
// this assumes that vfs->obj is fs_user_mount_t with block device functions
80-
disk_ioctl(MP_OBJ_TO_PTR(vfs->obj), CTRL_SYNC, NULL);
79+
if (mp_obj_is_type(vfs->obj, &mp_fat_vfs_type)) {
80+
disk_ioctl(MP_OBJ_TO_PTR(vfs->obj), CTRL_SYNC, NULL);
81+
}
8182
}
8283
#endif
8384
return mp_const_none;

0 commit comments

Comments
 (0)