summaryrefslogtreecommitdiff
path: root/TSRM
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2012-01-30 10:08:11 +0000
committerDmitry Stogov <dmitry@php.net>2012-01-30 10:08:11 +0000
commit2c90b8a06b442f1f4a0bb9285de75fc3c4b46ab4 (patch)
treeaf84ed1ea5848ad8bfb312fef4cc6c1ae0b02427 /TSRM
parent33863b2cf8367e607da0b8d185ccc37d23a6abb9 (diff)
downloadphp-git-2c90b8a06b442f1f4a0bb9285de75fc3c4b46ab4.tar.gz
Fixed bug #51860 (Include fails with toplevel symlink to /)
Diffstat (limited to 'TSRM')
-rw-r--r--TSRM/tsrm_virtual_cwd.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c
index 28b929d893..683d6a4d52 100644
--- a/TSRM/tsrm_virtual_cwd.c
+++ b/TSRM/tsrm_virtual_cwd.c
@@ -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