From dd5dff82de1c9fc601c861d8f443372af4a705d3 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 26 Jan 2007 15:15:32 +0000 Subject: [PATCH] Fixed bug #40231 (file_exists incorrectly reports false) --- TSRM/tsrm_virtual_cwd.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index d91f8ff609..e746353fed 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -549,6 +549,9 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func char *ptr, *path_copy, *free_path; char *tok = NULL; int ptr_length; +#ifdef TSRM_WIN32 + int is_unc = 0; +#endif no_realpath: @@ -569,6 +572,7 @@ no_realpath: state->cwd[1] = '\0'; state->cwd_length = 1; path_copy += 2; + is_unc = 2; } else { #endif state->cwd = (char *) realloc(state->cwd, 1); @@ -648,10 +652,14 @@ no_realpath: ptr_length = length; FindClose(hFind); } else if (use_realpath == CWD_REALPATH) { - free(free_path); - CWD_STATE_FREE(state); - *state = old_state; - return 1; + if (is_unc) { + is_unc--; + } else { + free(free_path); + CWD_STATE_FREE(state); + *state = old_state; + return 1; + } } } #endif -- 2.50.1