1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Minor fix for path_simplify.

Submitted in <sxsheqzx1qv.fsf@florida.arsdigita.de>.
This commit is contained in:
hniksic 2001-12-09 18:12:17 -08:00
parent 0e72aa6e13
commit 997a87548c
2 changed files with 9 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2001-12-10 Hrvoje Niksic <hniksic@arsdigita.com>
* utils.c (path_simplify): Correctly handle the unlikely case that
b starts out as path + 1.
2001-12-10 Hrvoje Niksic <hniksic@arsdigita.com>
* utils.c (path_simplify): Rewrite, with better comments, and

View File

@ -528,7 +528,7 @@ path_simplify (char *path)
{
/* Handle "../foo" by moving "foo" one path element to the
left. */
char *b = p;
char *b = p; /* not p-1 because P can equal PATH */
/* Backtrack by one path element, but not past the beginning
of PATH. */
@ -537,10 +537,10 @@ path_simplify (char *path)
/* ^ p */
/* ^ b */
if (b > path + 1)
if (b > path)
{
/* Find the character preceded by slash or by the
beginning of path. */
/* Move backwards until B hits the beginning of the
previous path element or the beginning of path. */
for (--b; b > path && *(b - 1) != '/'; b--)
;
}