diff options
| author | Dan Halbert <halbert@halwitz.org> | 2018-06-26 08:45:24 -0400 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2018-06-26 08:45:24 -0400 |
| commit | a7d3053049908c16424b2df17a484a99f9be4e9f (patch) | |
| tree | 3e692c6ed838e9340620589420179c70604a9e08 /shared-module | |
| parent | c1924f375d5398586887fc68b778080c420f9d4c (diff) | |
| parent | 5ae809474714f4fbf14332aea703174e5615fe52 (diff) | |
Update master with latest 3.x changes.
Diffstat (limited to 'shared-module')
| -rw-r--r-- | shared-module/storage/__init__.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/shared-module/storage/__init__.c b/shared-module/storage/__init__.c index cc10ebd5a..edce286b1 100644 --- a/shared-module/storage/__init__.c +++ b/shared-module/storage/__init__.c @@ -65,12 +65,15 @@ void common_hal_storage_mount(mp_obj_t vfs_obj, const char* mount_path, bool rea args[1] = mp_const_false; // Don't make the file system automatically when mounting. // Check that there's no file or directory with the same name as the mount point. - nlr_buf_t nlr; - if (nlr_push(&nlr) == 0) { - common_hal_os_stat(mount_path); - nlr_pop(); - // Something with the same name exists. - mp_raise_OSError(MP_EEXIST); + // But it's ok to mount '/' in any case. + if (strcmp(vfs->str, "/") != 0) { + nlr_buf_t nlr; + if (nlr_push(&nlr) == 0) { + common_hal_os_stat(mount_path); + nlr_pop(); + // Something with the same name exists. + mp_raise_OSError(MP_EEXIST); + } } // check that the destination mount point is unused |
