* path.cc (normalize_posix_path): Correctly deal with a "." parameter.

This commit is contained in:
Christopher Faylor 2000-09-11 17:21:13 +00:00
parent 9149d76e50
commit 867df927a6
2 changed files with 12 additions and 5 deletions

View File

@ -1,3 +1,7 @@
Mon Sep 11 13:19:15 2000 Christopher Faylor <cgf@cygnus.com>
* path.cc (normalize_posix_path): Correctly deal with a "." parameter.
Sun Sep 10 20:23:35 2000 Christopher Faylor <cgf@cygnus.com> Sun Sep 10 20:23:35 2000 Christopher Faylor <cgf@cygnus.com>
* cygheap.cc (init_cheap): Just use any old address for the cygwin * cygheap.cc (init_cheap): Just use any old address for the cygwin

View File

@ -593,8 +593,8 @@ normalize_posix_path (const char *src, char *dst)
{ {
while (*++src) while (*++src)
{ {
while (isslash (*src)) if (isslash (*src))
src++; continue;
if (*src != '.') if (*src != '.')
break; break;
@ -602,13 +602,15 @@ normalize_posix_path (const char *src, char *dst)
sawdot: sawdot:
if (src[1] != '.') if (src[1] != '.')
{ {
if (!src[1] || !isslash (src[1])) if (!src[1])
goto done;
if (!isslash (src[1]))
break; break;
} }
else if (src[2] && !isslash (src[2]))
break;
else else
{ {
if (src[2] && !isslash (src[2]))
break;
if (!ischrootpath (dst_start) || if (!ischrootpath (dst_start) ||
dst - dst_start != (int) myself->rootlen) dst - dst_start != (int) myself->rootlen)
while (dst > dst_start && !isslash (*--dst)) while (dst > dst_start && !isslash (*--dst))
@ -621,6 +623,7 @@ normalize_posix_path (const char *src, char *dst)
} }
} }
done:
*dst = '\0'; *dst = '\0';
if (--dst > dst_start && isslash (*dst)) if (--dst > dst_start && isslash (*dst))
*dst = '\0'; *dst = '\0';