diff options
author | Damien George <damien.p.george@gmail.com> | 2017-02-09 15:51:34 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-02-09 15:51:34 +1100 |
commit | 8f1c6d952ac695bc41afe8965aa79fbabcc6bcc1 (patch) | |
tree | 078e9c80b1840c2dfa0d2fe3da9dea5876921109 /extmod/vfs.c | |
parent | c66c39313026413472039d6dc0394e1903414713 (diff) |
extmod/vfs: Raise OSError(EEXIST) on attempt to mkdir a mount point.
Diffstat (limited to 'extmod/vfs.c')
-rw-r--r-- | extmod/vfs.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/extmod/vfs.c b/extmod/vfs.c index c1e32e052..98d8711e4 100644 --- a/extmod/vfs.c +++ b/extmod/vfs.c @@ -275,6 +275,9 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_vfs_listdir_obj, 0, 1, mp_vfs_listdir); mp_obj_t mp_vfs_mkdir(mp_obj_t path_in) { mp_obj_t path_out; mp_vfs_mount_t *vfs = lookup_path(path_in, &path_out); + if (vfs == MP_VFS_ROOT || (vfs != MP_VFS_NONE && !strcmp(mp_obj_str_get_str(path_out), "/"))) { + mp_raise_OSError(MP_EEXIST); + } return mp_vfs_proxy_call(vfs, MP_QSTR_mkdir, 1, &path_out); } MP_DEFINE_CONST_FUN_OBJ_1(mp_vfs_mkdir_obj, mp_vfs_mkdir); |