From: Andi Gutmans Date: Sun, 27 Feb 2000 05:22:48 +0000 (+0000) Subject: - Fix bug 3640 X-Git-Tag: PHP-4.0-RC1~377 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=312071bd082e44770e4a56eef0cec2e4414fb168;p=php - Fix bug 3640 --- 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);