Browse Source

fix bug #35999 (recursive mkdir() does not work with relative path like "foo/bar")

migration/RELEASE_1_0_0
Antony Dovgal 21 years ago
parent
commit
07ff99a075
  1. 17
      main/streams/plain_wrapper.c

17
main/streams/plain_wrapper.c

@ -1095,12 +1095,17 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, char *dir, int mod
offset = p - buf + 1;
}
/* find a top level directory we need to create */
while ((p = strrchr(buf + offset, DEFAULT_SLASH))) {
*p = '\0';
if (VCWD_STAT(buf, &sb) == 0) {
*p = DEFAULT_SLASH;
break;
if (p && dir_len == 1) {
/* buf == "DEFAULT_SLASH" */
}
else {
/* find a top level directory we need to create */
while ( (p = strrchr(buf + offset, DEFAULT_SLASH)) || (p = strrchr(buf, DEFAULT_SLASH)) ) {
*p = '\0';
if (VCWD_STAT(buf, &sb) == 0) {
*p = DEFAULT_SLASH;
break;
}
}
}

Loading…
Cancel
Save