From: Rui Hirokawa Date: Tue, 23 Apr 2002 14:55:10 +0000 (+0000) Subject: fixed access problem when japanese Shift_JIS character is used as directory name... X-Git-Tag: php-4.2.1RC1~50 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d126bace5f02b88022c0866ad15ff2e87313e586;p=php fixed access problem when japanese Shift_JIS character is used as directory name. Some characters in Shift_JIS are including 0x5c (slash) as second byte. --- diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index ae8efd93e4..9c1a5d2925 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -68,7 +68,8 @@ cwd_state main_cwd_state; /* True global */ #endif #ifdef TSRM_WIN32 -#define tsrm_strtok_r(a,b,c) strtok((a),(b)) +#include +#define tsrm_strtok_r(a,b,c) _tcstok((a),(b)) #define TOKENIZER_STRING "/\\" static int php_check_dots(const char *element, int n) diff --git a/win32/readdir.c b/win32/readdir.c index 8c17ce2b22..694a409c35 100644 --- a/win32/readdir.c +++ b/win32/readdir.c @@ -29,7 +29,8 @@ DIR *opendir(const char *dir) filespec = malloc(strlen(dir) + 2 + 1); strcpy(filespec, dir); index = strlen(filespec) - 1; - if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\')) + if (index >= 0 && (filespec[index] == '/' || + (filespec[index] == '\\' && !IsDBCSLeadByte(filespec[index-1])))) filespec[index] = '\0'; strcat(filespec, "/*");