diff options
author | Dmitry Stogov <dmitry@php.net> | 2007-02-21 13:09:03 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2007-02-21 13:09:03 +0000 |
commit | d4ccfade57301ac18172883a13a938d3c0568e35 (patch) | |
tree | 3bf29e78262e87b6df7a9ed84b24ed8f0823d9e9 /TSRM | |
parent | 6b253ae064274b81191e698fe8e265d11ab7c311 (diff) | |
download | php-git-d4ccfade57301ac18172883a13a938d3c0568e35.tar.gz |
Fixed bug #40560 (DIR functions do not work on root UNC path)
Diffstat (limited to 'TSRM')
-rw-r--r-- | TSRM/tsrm_virtual_cwd.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index 78db6c0be9..fd253309ee 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -550,13 +550,16 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func char *ptr, *path_copy, *free_path; char *tok; int ptr_length; - +#ifdef TSRM_WIN32 + int is_unc; +#endif no_realpath: free_path = path_copy = tsrm_strndup(path, path_length); CWD_STATE_COPY(&old_state, state); -#ifdef TSRM_WIN32 +#ifdef TSRM_WIN32 + is_unc = 0; if (path_length >= 2 && path[1] == ':') { state->cwd = (char *) realloc(state->cwd, 2 + 1); state->cwd[0] = toupper(path[0]); @@ -570,6 +573,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); @@ -651,7 +655,13 @@ no_realpath: FindClose(hFind); ret = 0; } else if (use_realpath == CWD_REALPATH) { - ret = 1; + if (is_unc) { + /* skip share name */ + is_unc--; + ret = 0; + } else { + ret = 1; + } } } #endif |