mirror of
https://github.com/php/php-src.git
synced 2025-08-20 17:34:35 +02:00
fix bug #35999 (recursive mkdir() does not work with relative path like "foo/bar")
This commit is contained in:
parent
9e7ddd51ee
commit
07ff99a075
1 changed files with 11 additions and 6 deletions
|
@ -1095,14 +1095,19 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, char *dir, int mod
|
||||||
offset = p - buf + 1;
|
offset = p - buf + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p && dir_len == 1) {
|
||||||
|
/* buf == "DEFAULT_SLASH" */
|
||||||
|
}
|
||||||
|
else {
|
||||||
/* find a top level directory we need to create */
|
/* find a top level directory we need to create */
|
||||||
while ((p = strrchr(buf + offset, DEFAULT_SLASH))) {
|
while ( (p = strrchr(buf + offset, DEFAULT_SLASH)) || (p = strrchr(buf, DEFAULT_SLASH)) ) {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
if (VCWD_STAT(buf, &sb) == 0) {
|
if (VCWD_STAT(buf, &sb) == 0) {
|
||||||
*p = DEFAULT_SLASH;
|
*p = DEFAULT_SLASH;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (p == buf) {
|
if (p == buf) {
|
||||||
ret = php_mkdir(dir, mode TSRMLS_CC);
|
ret = php_mkdir(dir, mode TSRMLS_CC);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue