summaryrefslogtreecommitdiff
path: root/shared-module
diff options
context:
space:
mode:
authorhathach <thach@tinyusb.org>2018-07-03 17:29:28 +0700
committerhathach <thach@tinyusb.org>2018-07-03 17:29:28 +0700
commitb14b28067e287bde3021e85e42f97bee2468c087 (patch)
tree12ab02c53bcbc03eb8cb77282964be848b34f3a9 /shared-module
parentc4f11dfd32e94559412f79ce09781d6780cbb76e (diff)
parent321daa3523a0b1ddc9591e20da969c422fd3b2ae (diff)
Merge branch 'master' into nrf52840_usbboot
Diffstat (limited to 'shared-module')
-rw-r--r--shared-module/storage/__init__.c15
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