Skip to content

Commit

Permalink
extmod/vfs: Raise OSError(ENODEV) if mounting bdev without a filesystem.
Browse files Browse the repository at this point in the history
This commit prevents uos.mount() from raising an AttributeError.
vfs_autodetect() is supposed to return an object that has a "mount" method,
so if no filesystem is found it should raise an OSError(ENODEV) and not
return the bdev itself which has no "mount" method.
  • Loading branch information
Oliver Joos authored and pfalcon committed Dec 30, 2020
1 parent d0fcd30 commit 6e7a66a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion extmod/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ STATIC mp_obj_t mp_vfs_autodetect(mp_obj_t bdev_obj) {
return mp_fat_vfs_type.make_new(&mp_fat_vfs_type, 1, 0, &bdev_obj);
#endif

return bdev_obj;
// no filesystem found
mp_raise_OSError(MP_ENODEV);
}

mp_obj_t mp_vfs_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
Expand Down

0 comments on commit 6e7a66a

Please sign in to comment.