Browse Source

Likely fix for bug #33140

PHP-5.1
Ilia Alshanetsky 21 years ago
parent
commit
87d6f497f7
  1. 8
      main/streams/plain_wrapper.c

8
main/streams/plain_wrapper.c

@ -1079,18 +1079,24 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, char *dir, int mod
char *e, *buf;
struct stat sb;
int dir_len = strlen(dir);
int offset = 0;
buf = estrndup(dir, dir_len);
e = buf + dir_len;
if ((p = memchr(buf, DEFAULT_SLASH, dir_len))) {
offset = p - buf + 1;
}
/* find a top level directory we need to create */
while ((p = strrchr(buf, DEFAULT_SLASH))) {
while ((p = strrchr(buf + offset, DEFAULT_SLASH))) {
*p = '\0';
if (VCWD_STAT(buf, &sb) == 0) {
*p = DEFAULT_SLASH;
break;
}
}
if (p == buf) {
ret = php_mkdir(dir, mode TSRMLS_CC);
} else if (!(ret = php_mkdir(buf, mode TSRMLS_CC))) {

Loading…
Cancel
Save