From: Zeev Suraski Date: Thu, 3 May 2001 15:50:37 +0000 (+0000) Subject: Fix chdir() under Windows 9x/ME X-Git-Tag: php-4.0.6RC1~165 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cbb777f1676cc6e676d0de592ca97f245c3f0ede;p=php Fix chdir() under Windows 9x/ME --- diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index b93c5e51eb..80e09e5dec 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -364,10 +364,14 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func } } else if (!IS_DIRECTORY_CURRENT(ptr, ptr_length)) { state->cwd = (char *) realloc(state->cwd, state->cwd_length+ptr_length+1+1); - state->cwd[state->cwd_length] = DEFAULT_SLASH; - memcpy(&state->cwd[state->cwd_length+1], ptr, ptr_length+1); - state->cwd_length += (ptr_length+1); - } +#ifdef TSRM_WIN32 + /* Windows 9x will consider C:\\Foo as a network path. Avoid it. */ + if (state->cwd[state->cwd_length-1]!=DEFAULT_SLASH) { + state->cwd[state->cwd_length++] = DEFAULT_SLASH; + } +#endif + memcpy(&state->cwd[state->cwd_length], ptr, ptr_length+1); + state->cwd_length += ptr_length; } ptr = tsrm_strtok_r(NULL, TOKENIZER_STRING, &tok); }