cvs: php-src(PHP_5_2) /main win95nt.h /main/streams plain_wrapper.c

From: Date: Thu, 19 Oct 2006 09:49:44 +0000
Subject: cvs: php-src(PHP_5_2) /main win95nt.h /main/streams plain_wrapper.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-41160@lists.php.net to get a copy of this message
dmitry Thu Oct 19 09:49:44 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/main win95nt.h /php-src/main/streams plain_wrapper.c Log: Fixed mkdir("/tmp/foo//bar/log", 0777, true) http://cvs.php.net/viewvc.cgi/php-src/main/win95nt.h?r1=1.20.2.2&r2=1.20.2.2.2.1&diff_format=u Index: php-src/main/win95nt.h diff -u php-src/main/win95nt.h:1.20.2.2 php-src/main/win95nt.h:1.20.2.2.2.1 --- php-src/main/win95nt.h:1.20.2.2 Sun Jan 1 12:50:17 2006 +++ php-src/main/win95nt.h Thu Oct 19 09:49:44 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: win95nt.h,v 1.20.2.2 2006/01/01 12:50:17 sniper Exp $ */ +/* $Id: win95nt.h,v 1.20.2.2.2.1 2006/10/19 09:49:44 dmitry Exp $ */ /* Defines and types for Windows 95/NT */ #define HAVE_DECLARED_TIMEZONE @@ -41,7 +41,7 @@ #ifndef S_ISREG #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif -#define chdir(path) SetCurrentDirectory(path) +#define chdir(path) _chdir(path) #define mkdir(a, b) _mkdir(a) #define rmdir(a) _rmdir(a) #define getpid _getpid http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.52.2.6.2.7&r2=1.52.2.6.2.8&diff_format=u Index: php-src/main/streams/plain_wrapper.c diff -u php-src/main/streams/plain_wrapper.c:1.52.2.6.2.7 php-src/main/streams/plain_wrapper.c:1.52.2.6.2.8 --- php-src/main/streams/plain_wrapper.c:1.52.2.6.2.7 Thu Sep 28 07:26:02 2006 +++ php-src/main/streams/plain_wrapper.c Thu Oct 19 09:49:44 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: plain_wrapper.c,v 1.52.2.6.2.7 2006/09/28 07:26:02 dmitry Exp $ */ +/* $Id: plain_wrapper.c,v 1.52.2.6.2.8 2006/10/19 09:49:44 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -1087,7 +1087,18 @@ int offset = 0; buf = estrndup(dir, dir_len); + +#ifdef PHP_WIN32 + e = buf; + while (*e) { + if (*e == '/') { + *e = DEFAULT_SLASH; + } + e++; + } +#else e = buf + dir_len; +#endif if ((p = memchr(buf, DEFAULT_SLASH, dir_len))) { offset = p - buf + 1; @@ -1099,9 +1110,21 @@ else { /* find a top level directory we need to create */ while ( (p = strrchr(buf + offset, DEFAULT_SLASH)) || ( offset !=1 && (p = strrchr(buf, DEFAULT_SLASH))) ) { + int n = 0; + *p = '\0'; + while (p > buf && *(p-1) == DEFAULT_SLASH) { + ++n; + --p; + *p = '\0'; + } if (VCWD_STAT(buf, &sb) == 0) { - *p = DEFAULT_SLASH; + while (1) { + *p = DEFAULT_SLASH; + if (!n) break; + --n; + ++p; + } break; } } @@ -1115,9 +1138,10 @@ } /* create any needed directories if the creation of the 1st directory worked */ while (++p != e) { - if (*p == '\0' && *(p + 1) != '\0') { + if (*p == '\0') { *p = DEFAULT_SLASH; - if ((ret = VCWD_MKDIR(buf, (mode_t)mode)) < 0) { + if ((*(p+1) != '\0') && + (ret = VCWD_MKDIR(buf, (mode_t)mode)) < 0) { if (options & REPORT_ERRORS) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); }

« previous php.cvs (#41160) next »