summaryrefslogtreecommitdiff
path: root/main/fopen_wrappers.c
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2000-02-27 05:22:48 +0000
committerAndi Gutmans <andi@php.net>2000-02-27 05:22:48 +0000
commit312071bd082e44770e4a56eef0cec2e4414fb168 (patch)
treeedaf5c330b361550777e7ea9cc42ae2808ae2577 /main/fopen_wrappers.c
parent908cdfafe1547805f42c0a13a433df29bc2385a0 (diff)
downloadphp-git-312071bd082e44770e4a56eef0cec2e4414fb168.tar.gz
- Fix bug 3640
Diffstat (limited to 'main/fopen_wrappers.c')
-rw-r--r--main/fopen_wrappers.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index bd3db7c116..50f57dc7bc 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -975,12 +975,20 @@ PHPAPI char *expand_filepath(char *filepath)
if (filepath[1] == '.') { /* parent directory - .. */
/* erase the last directory name from the path */
+#if PHP_WIN32
+ while (*cwd_end != '/' || *cwd_end != '\\') {
+#else
while (*cwd_end != '/') {
+#endif
*cwd_end-- = 0;
}
filepath++; /* make filepath appear as a current directory path */
}
+#if PHP_WIN32
+ if (cwd_end > cwd && (*cwd_end == '/' || *cwd_end == '\\')) { /* remove trailing slashes */
+#else
if (cwd_end > cwd && *cwd_end == '/') { /* remove trailing slashes */
+#endif
*cwd_end-- = 0;
}
retval = (char *) malloc(strlen(cwd) + strlen(filepath) - 1 + 1);