diff options
author | Ondřej Surý <ondrej@sury.org> | 2012-02-03 11:02:43 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2012-02-03 11:02:43 +0100 |
commit | 5292df2401c781de56fd04835c18e11162152626 (patch) | |
tree | 34d9215e87887fb4f97b051ac3fa239d6cf4ee89 /TSRM | |
parent | 96fb2ff5760132a915766f1d9ec7c63001feacd8 (diff) | |
download | php-5292df2401c781de56fd04835c18e11162152626.tar.gz |
Imported Upstream version 5.4.0~rc7upstream/5.4.0_rc7
Diffstat (limited to 'TSRM')
-rw-r--r-- | TSRM/tsrm_virtual_cwd.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index 27474e43c..475d99d47 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tsrm_virtual_cwd.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id: tsrm_virtual_cwd.c 322927 2012-01-30 10:08:11Z dmitry $ */ #include <sys/types.h> #include <sys/stat.h> @@ -760,6 +760,9 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i while (1) { if (len <= start) { + if (link_is_dir) { + *link_is_dir = 1; + } return start; } @@ -776,6 +779,10 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i continue; } else if (i == len - 2 && path[i] == '.' && path[i+1] == '.') { /* remove '..' and previous directory */ + is_dir = 1; + if (link_is_dir) { + *link_is_dir = 1; + } if (i - 1 <= start) { return start ? start : len; } @@ -1200,9 +1207,14 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func return 1; } memcpy(resolved_path, state->cwd, state_cwd_length); - resolved_path[state_cwd_length] = DEFAULT_SLASH; - memcpy(resolved_path + state_cwd_length + 1, path, path_length + 1); - path_length += state_cwd_length + 1; + if (resolved_path[state_cwd_length-1] == DEFAULT_SLASH) { + memcpy(resolved_path + state_cwd_length, path, path_length + 1); + path_length += state_cwd_length; + } else { + resolved_path[state_cwd_length] = DEFAULT_SLASH; + memcpy(resolved_path + state_cwd_length + 1, path, path_length + 1); + path_length += state_cwd_length + 1; + } } } else { #ifdef TSRM_WIN32 |