]> granicus.if.org Git - php/commitdiff
MFB: fix #37395 (recursive mkdir() fails to create nonexistent directories in root...
authorAntony Dovgal <tony2001@php.net>
Tue, 16 May 2006 13:05:23 +0000 (13:05 +0000)
committerAntony Dovgal <tony2001@php.net>
Tue, 16 May 2006 13:05:23 +0000 (13:05 +0000)
main/streams/plain_wrapper.c

index adfb9b4bf1a322d09aceecd3a3a98f1f7f4cb07c..710bb863decdd6f637092c66a52960112c050f71 100644 (file)
@@ -1081,7 +1081,7 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, char *dir, int mod
                }
                else {
                        /* find a top level directory we need to create */
-                       while ( (p = strrchr(buf + offset, DEFAULT_SLASH)) || (p = strrchr(buf, DEFAULT_SLASH)) ) {
+                       while ( (p = strrchr(buf + offset, DEFAULT_SLASH)) || (offset != 1 && (p = strrchr(buf, DEFAULT_SLASH))) ) {
                                *p = '\0';
                                if (VCWD_STAT(buf, &sb) == 0) {
                                        *p = DEFAULT_SLASH;