prefix.c (update_path): Don't zap single .' path components unless followed by another .' and fix...

* prefix.c (update_path): Don't zap single `.' path components
	unless followed by another `.' and fix typo last patch.

From-SVN: r55586
This commit is contained in:
Alan Modra 2002-07-19 13:24:55 +00:00 committed by Alan Modra
parent c42c75bfc4
commit c35383cbdf
2 changed files with 16 additions and 5 deletions

View file

@ -1,3 +1,8 @@
2002-07-19 Alan Modra <amodra@bigpond.net.au>
* prefix.c (update_path): Don't zap single `.' path components
unless followed by another `.' and fix typo last patch.
2002-07-18 Neil Booth <neil@daikokuya.co.uk> 2002-07-18 Neil Booth <neil@daikokuya.co.uk>
* cppexp.c (cpp_num_mul): Remove unused parameter. * cppexp.c (cpp_num_mul): Remove unused parameter.

View file

@ -284,7 +284,8 @@ update_path (path, key)
p = strchr (p, '.'); p = strchr (p, '.');
if (p == NULL) if (p == NULL)
break; break;
/* Get rid of a leading `./' and replace `/./' with `/'. */ /* Get rid of a leading `./' and replace `/./' with `/', when
such components are followed with another `.'. */
if (IS_DIR_SEPARATOR (p[1]) if (IS_DIR_SEPARATOR (p[1])
&& (p == result || IS_DIR_SEPARATOR (p[-1]))) && (p == result || IS_DIR_SEPARATOR (p[-1])))
{ {
@ -292,9 +293,14 @@ update_path (path, key)
/* Be careful about .//foo */ /* Be careful about .//foo */
while (IS_DIR_SEPARATOR (*src)) while (IS_DIR_SEPARATOR (*src))
++src; ++src;
dest = p; if (*src == '.')
while ((*dest++ = *src++) != 0) {
; dest = p;
while ((*dest++ = *src++) != 0)
;
}
else
++p;
} }
/* Look for `/../' */ /* Look for `/../' */
else if (p[1] == '.' else if (p[1] == '.'
@ -316,7 +322,7 @@ update_path (path, key)
dest = p - 1; dest = p - 1;
while (dest != result && IS_DIR_SEPARATOR (*dest)) while (dest != result && IS_DIR_SEPARATOR (*dest))
--dest; --dest;
while (dest != result && IS_DIR_SEPARATOR (dest[-1])) while (dest != result && !IS_DIR_SEPARATOR (dest[-1]))
--dest; --dest;
/* Don't strip leading `/'. */ /* Don't strip leading `/'. */
while (IS_DIR_SEPARATOR (*dest)) while (IS_DIR_SEPARATOR (*dest))