diff options
| -rw-r--r-- | misc.c | 6 | 
1 files changed, 5 insertions, 1 deletions
| @@ -251,7 +251,8 @@ int is_dir(const char *path) {  void mkdirp(const char *path, int mode) {  	char *str = make_str(path); -	for (char *p = find_delm(str, "/", *str == '/'); !is_empty(p); p = find_delm(p, "/", 1)) { +	for (char *p = find_delm(str, "/", *str == '/'); !is_empty(p); p = find_delm(p, "/", *p == '/')) { +		const size_t span = strspn(p, "/");  		if (*p == '/') {  			*p = '\0';  		} @@ -260,6 +261,9 @@ void mkdirp(const char *path, int mode) {  		}  		if (*p == '\0') {  			*p = '/'; +			if (*find_delm(&p[span], "/", 0) != '\0') { +				p += span; +			}  		}  	} | 
