diff options
author | ZyX <kp-pav@yandex.ru> | 2015-10-19 15:25:49 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2015-10-23 14:54:11 +0300 |
commit | fefcc01cc1da9540767a2c0b14ebb532a51dd412 (patch) | |
tree | 003eb362ffb2fa64df78b7541e07da1e56d7146f /src | |
parent | 030c608b7dee6662a9771a3acadb069b5eaab218 (diff) | |
download | rneovim-fefcc01cc1da9540767a2c0b14ebb532a51dd412.tar.gz rneovim-fefcc01cc1da9540767a2c0b14ebb532a51dd412.tar.bz2 rneovim-fefcc01cc1da9540767a2c0b14ebb532a51dd412.zip |
os/fs: Allow os_mkdir_recurse directory name to end with ///
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/os/fs.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index 522e49950c..05f0f53c63 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -366,11 +366,17 @@ int os_mkdir_recurse(const char *const dir, int32_t mode, } while (e != real_end) { if (e > past_head) { - *e = '/'; + *e = PATHSEP; } else { *past_head = past_head_save; } - e += strlen(e); + const size_t component_len = strlen(e); + e += component_len; + if (e == real_end + && memcnt(e - component_len, PATHSEP, component_len) == component_len) { + // Path ends with something like "////". Ignore this. + break; + } int ret; if ((ret = os_mkdir(curdir, mode)) != 0) { *failed_dir = curdir; |