cvs: php-src /main/streams plain_wrapper.c
| From: | Antony Dovgal | Date: | Mon, 16 Jan 2006 19:47:07 +0000 |
| Subject: | cvs: php-src /main/streams plain_wrapper.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-36533@lists.php.net to get a copy of this message | ||
tony2001 Mon Jan 16 19:47:07 2006 UTC
Modified files:
/php-src/main/streams plain_wrapper.c
Log:
fix bug #35999 (recursive mkdir() does not work with relative path like "foo/bar")
http://cvs.php.net/viewcvs.cgi/php-src/main/streams/plain_wrapper.c?r1=1.56&r2=1.57&diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.56 php-src/main/streams/plain_wrapper.c:1.57
--- php-src/main/streams/plain_wrapper.c:1.56 Sun Jan 1 13:09:57 2006
+++ php-src/main/streams/plain_wrapper.c Mon Jan 16 19:47:07 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: plain_wrapper.c,v 1.56 2006/01/01 13:09:57 sniper Exp $ */
+/* $Id: plain_wrapper.c,v 1.57 2006/01/16 19:47:07 tony2001 Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -1095,12 +1095,17 @@
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;
+ }
}
}