cvs: TSRM / tsrm_virtual_cwd.c
| From: | Dmitry Stogov | Date: | Thu, 05 Oct 2006 08:04:51 +0000 |
| Subject: | cvs: TSRM / tsrm_virtual_cwd.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-5303@lists.php.net to get a copy of this message | ||
dmitry Thu Oct 5 08:04:51 2006 UTC
Modified files:
/TSRM tsrm_virtual_cwd.c
Log:
Fixed bug #38989 (Absolute path with slash at beginning doesn't work on win)
http://cvs.php.net/viewvc.cgi/TSRM/tsrm_virtual_cwd.c?r1=1.88&r2=1.89&diff_format=u
Index: TSRM/tsrm_virtual_cwd.c
diff -u TSRM/tsrm_virtual_cwd.c:1.88 TSRM/tsrm_virtual_cwd.c:1.89
--- TSRM/tsrm_virtual_cwd.c:1.88 Wed Oct 4 13:24:05 2006
+++ TSRM/tsrm_virtual_cwd.c Thu Oct 5 08:04:51 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: tsrm_virtual_cwd.c,v 1.88 2006/10/04 13:24:05 tony2001 Exp $ */
+/* $Id: tsrm_virtual_cwd.c,v 1.89 2006/10/05 08:04:51 dmitry Exp $ */
#include <sys/types.h>
#include <sys/stat.h>
@@ -386,14 +386,21 @@
* This can happen under solaris when a dir does not have read permissions
* but *does* have execute permissions */
if (!IS_ABSOLUTE_PATH(path, path_length) && (state->cwd_length > 1)) {
- int orig_path_len = path_length + state->cwd_length + 1;
+ int orig_path_len;
+ int state_cwd_length = state->cwd_length;
+#ifdef TSRM_WIN32
+ if (IS_SLASH(path[0])) {
+ state_cwd_length = 2;
+ }
+#endif
+ orig_path_len = path_length + state_cwd_length + 1;
if (orig_path_len >= MAXPATHLEN) {
return 1;
}
- memcpy(orig_path, state->cwd, state->cwd_length);
- orig_path[state->cwd_length] = DEFAULT_SLASH;
- memcpy(orig_path + state->cwd_length + 1, path, path_length + 1);
+ memcpy(orig_path, state->cwd, state_cwd_length);
+ orig_path[state_cwd_length] = DEFAULT_SLASH;
+ memcpy(orig_path + state_cwd_length + 1, path, path_length + 1);
path = orig_path;
path_length = orig_path_len;
}