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

diff --git a/NEWS b/NEWS
index dcbfe0d1815ac3542a2ed4feb94660529cd230df..1adaff85aea2f1f7b3d5a217653a488f82963519 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -38,7 +38,9 @@ PHP                                                                        NEWS
 - Added pg_field_table() function. (Edin)
 - Added implementation of curl_multi_info_read(). (Brian)
 - Added RFC2397 (data: stream) support. (Marcus)
-- Fixed Bug #37457 (Crash when an exception is thrown in accept() method of 
+- Fixed bug #37395 (recursive mkdir() fails to create nonexistent directories 
+  in root dir). (Tony)
+- Fixed bug #37457 (Crash when an exception is thrown in accept() method of 
   FilterIterator). (Marcus)
 - Fixed bug #37416 (iterator_to_array() hides exceptions thrown in rewind()
   method). (Tony)
index ac5ad825dbb578049ba0bcf5d71280e8b21e50ce..2180318fcfbe8c3e314e2257d6f0fa8ec31d8402 100644 (file)
@@ -1100,7 +1100,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;