diff options
author | Oliver Joos <oliver.joos@feller.ch> | 2020-11-27 11:09:16 +0100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2020-12-17 22:44:03 +1100 |
commit | a13d1b50c93802b9ce6be8dac0fec53545656ef7 (patch) | |
tree | 438e760164a2429cbfdd3f5043105a9e2a45d0aa /extmod/vfs.c | |
parent | dc1fd4df7360d101952426dd0d1574d3971e50f5 (diff) | |
download | micropython-a13d1b50c93802b9ce6be8dac0fec53545656ef7.tar.gz micropython-a13d1b50c93802b9ce6be8dac0fec53545656ef7.zip |
extmod/vfs: Raise OSError(ENODEV) if mounting bdev without a filesystem.
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.
Diffstat (limited to 'extmod/vfs.c')
-rw-r--r-- | extmod/vfs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/extmod/vfs.c b/extmod/vfs.c index 3cb7af1b43..7dca59d351 100644 --- a/extmod/vfs.c +++ b/extmod/vfs.c @@ -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) { |