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:
parent
0e72aa6e13
commit
997a87548c
@ -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
|
||||
|
@ -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--)
|
||||
;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user